-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Queue data structures. -- -- Queue data structures, as described in -- -- -- -- A queue has a "back" where new elements are enqueued, and a "front" -- where elements are dequeued in the order that they were enqueued (last -- in, first out). -- -- The queues provided in this library also support an "enqueue at front" -- operation, because the underlying representations happen to support -- it, so you might technically refer to these data structures as -- output-restricted deques. -- -- In this library, it is helpful to think of the "front" being on the -- left, because (though the direction is arbitrary) we are -- consistent throughout, where it matters: -- -- -- -- Under "ephemeral" (or "single-threaded", or "linear") usage, wherein -- one does not need to refer to an old version of a data structure after -- mutating it: -- -- -- -- (These numbers vary from benchmark to benchmark and machine to -- machine. Always perform your own experiments!) -- -- While it is certainly common to use a queue ephemerally, it is unusual -- for a Haskell data structure to require ephemeral usage to achieve its -- stated bounds. A refactoring or change in requirements might cause -- surprising changes in performance. That is why EphemeralQueue -- has a longer name and module name. When in doubt, use Queue. @package queues @version 1.0.0 -- | A queue data structure with <math> (worst-case) operations, as -- described in -- -- module Queue -- | A queue data structure with <math> (worst-case) operations. data Queue a -- | An empty queue. pattern Empty :: Queue a -- | The front of a queue, and the rest of it. pattern Full :: a -> Queue a -> Queue a -- | An empty queue. empty :: Queue a -- | A singleton queue. singleton :: a -> Queue a -- | <math>. Construct a queue from a list. The head of the list -- corresponds to the front of the queue. fromList :: [a] -> Queue a -- | <math>. Enqueue an element at the back of a queue, to be -- dequeued last. enqueue :: a -> Queue a -> Queue a -- | <math> front, <math> rest. Dequeue an element from the -- front of a queue. dequeue :: Queue a -> Maybe (a, Queue a) -- | <math>. Enqueue an element at the front of a queue, to be -- dequeued next. enqueueFront :: a -> Queue a -> Queue a -- | <math>. Is a queue empty? isEmpty :: Queue a -> Bool -- | <math>. Apply a function to every element in a queue. map :: (a -> b) -> Queue a -> Queue b -- | <math>. Apply a function to every element in a queue. traverse :: Applicative f => (a -> f b) -> Queue a -> f (Queue b) -- | <math>. Construct a list from a queue. The head of the list -- corresponds to the front of the queue. toList :: Queue a -> [a] instance GHC.Base.Functor Queue.Queue instance GHC.Classes.Eq a => GHC.Classes.Eq (Queue.Queue a) instance Data.Foldable.Foldable Queue.Queue instance GHC.Base.Monoid (Queue.Queue a) instance GHC.Base.Semigroup (Queue.Queue a) instance GHC.Show.Show a => GHC.Show.Show (Queue.Queue a) instance Data.Traversable.Traversable Queue.Queue -- | A queue data structure with <math> (amortized under ephemeral -- usage only) operations, as described in -- -- module Queue.Ephemeral -- | A queue data structure with <math> (amortized under ephemeral -- usage only) operations. data EphemeralQueue a -- | An empty queue. pattern Empty :: EphemeralQueue a -- | The front of a queue, and the rest of it. pattern Full :: a -> EphemeralQueue a -> EphemeralQueue a -- | An empty queue. empty :: EphemeralQueue a -- | A singleton queue. singleton :: a -> EphemeralQueue a -- | <math>. Construct a queue from a list. The head of the list -- corresponds to the front of the queue. fromList :: [a] -> EphemeralQueue a -- | <math>. Enqueue an element at the back of a queue, to be -- dequeued last. enqueue :: a -> EphemeralQueue a -> EphemeralQueue a -- | <math> front, <math> rest. Dequeue an element from the -- front of a queue. dequeue :: EphemeralQueue a -> Maybe (a, EphemeralQueue a) -- | <math>. Enqueue an element at the front of a queue, to be -- dequeued next. enqueueFront :: a -> EphemeralQueue a -> EphemeralQueue a -- | <math>. Is a queue empty? isEmpty :: EphemeralQueue a -> Bool -- | <math>. Apply a function to every element in a queue. map :: (a -> b) -> EphemeralQueue a -> EphemeralQueue b -- | <math>. Apply a function to every element in a queue. traverse :: Applicative f => (a -> f b) -> EphemeralQueue a -> f (EphemeralQueue b) -- | <math>. Construct a list from a queue. The head of the list -- corresponds to the front of the queue. toList :: EphemeralQueue a -> [a] instance GHC.Base.Functor Queue.Ephemeral.EphemeralQueue instance GHC.Classes.Eq a => GHC.Classes.Eq (Queue.Ephemeral.EphemeralQueue a) instance Data.Foldable.Foldable Queue.Ephemeral.EphemeralQueue instance GHC.Base.Monoid (Queue.Ephemeral.EphemeralQueue a) instance GHC.Base.Semigroup (Queue.Ephemeral.EphemeralQueue a) instance GHC.Show.Show a => GHC.Show.Show (Queue.Ephemeral.EphemeralQueue a) instance Data.Traversable.Traversable Queue.Ephemeral.EphemeralQueue