parsley-core-1.6.0.0: A fast parser combinator library backed by Typed Template Haskell
LicenseBSD-3-Clause
MaintainerJamie Willis
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Parsley.Internal.Common.QueueLike

Description

Exposes the core shared operations of queue implementations.

Since: 1.5.0.0

Synopsis

Documentation

class QueueLike q where Source #

Operations on a queue-like structure q. These operations should be efficient, with amortized constant complexity for all of them except enqueueAll.

Since: 1.5.0.0

Methods

empty :: q a Source #

Construct an empty queue.

Since: 1.5.0.0

null :: q a -> Bool Source #

Is the queue empty?

Since: 1.5.0.0

size :: q a -> Int Source #

Returns how many elements are in the queue.

Since: 1.5.0.0

enqueue :: a -> q a -> q a Source #

Adds an element onto the end of the queue.

Since: 1.5.0.0

dequeue :: q a -> (a, q a) Source #

Removes an element from the front of the queue.

Since: 1.5.0.0

enqueueAll :: [a] -> q a -> q a Source #

Adds each of the elements onto the queue, from left-to-right.

Since: 1.5.0.0

Instances

Instances details
QueueLike Queue Source # 
Instance details

Defined in Parsley.Internal.Common.Queue

Methods

empty :: Queue a Source #

null :: Queue a -> Bool Source #

size :: Queue a -> Int Source #

enqueue :: a -> Queue a -> Queue a Source #

dequeue :: Queue a -> (a, Queue a) Source #

enqueueAll :: [a] -> Queue a -> Queue a Source #

QueueLike RewindQueue Source # 
Instance details

Defined in Parsley.Internal.Common.RewindQueue