LambdaHack-0.2.6: A roguelike game engine in early and active development

Safe HaskellSafe-Inferred

Game.LambdaHack.Utils.LQueue

Description

Queues implemented with two stacks to ensure fast writes.

Synopsis

Documentation

type LQueue a = ([a], [a])Source

Queues implemented with two stacks.

newLQueue :: LQueue aSource

Create a new empty mutable queue.

nullLQueue :: LQueue a -> BoolSource

Check if the queue is empty.

trimLQueue :: LQueue (Maybe a) -> LQueue (Maybe a)Source

Remove all but the last written non-Nothing element of the queue.

tryReadLQueue :: LQueue a -> Maybe (a, LQueue a)Source

Try reading a queue. Return Nothing if empty.

writeLQueue :: LQueue a -> a -> LQueue aSource

Write to the queue. Faster than reading.