Copyright | (c) Leon P Smith 2009-2011 |
---|---|

License | BSD3 |

Maintainer | leon@melding-monads.com |

Stability | experimental |

Safe Haskell | Safe |

Language | Haskell98 |

A library implementation of corecursive queues, see
*Circular Programs and Self-Referential Structures* by Lloyd Allison,
*Software Practice and Experience*, 19(2), pp.99-109, Feb 1989

http://www.csse.monash.edu.au/~lloyd/tildeFP/1989SPE/

For an explanation of the library implementation, see
*Lloyd Allison's Corecursive Queues: Why Continuations Matter*
by Leon P Smith, in *The Monad Reader*, Issue 14, Jul 2009. This library
corresponds to `CorecQ`

in that paper.

http://themonadreader.files.wordpress.com/2009/07/issue142.pdf

- data Q e a
- type LenType = Word
- runQueue :: Q e a -> [e]
- enQ :: e -> Q e ()
- deQ :: Q e (Maybe e)
- deQs :: Integral len => len -> Q e [e]
- deQ_break :: Q e e
- peekQ :: Q e (Maybe e)
- peekQn :: Integral index => index -> Q e (Maybe e)
- peekQs :: Integral maxlen => maxlen -> Q e [e]
- lenQ :: Integral len => Q e len
- lenQ_ :: Q e LenType
- callCC :: ((a -> forall b. Q e b) -> Q e a) -> Q e a
- exit :: Q e a

# Documentation

Dequeues an element: terminates the queue computation if the queue is empty.

peekQn :: Integral index => index -> Q e (Maybe e) Source

Examines the element currently at position `index`

in the queue, indexing starts with `0`

, like `!!`

.