Queue

GitHub   Edit on GitHub

An immutable queue implementation. A queue is a FIFO (first-in-first-out) data structure where new values are added to the end and retrieved or removed from the beginning.

1
import Queue from "queue"

Values

Queue.make

1
make : () -> Queue<a>

Creates a new queue.

Queue.isEmpty

1
isEmpty : Queue<a> -> Bool

Checks if the given queue contains no elements.

Queue.head

1
head : Queue<a> -> Option<a>

Returns Some(item) with the next item in the queue, or None if the queue is empty.

Queue.enqueue

1
enqueue : (a, Queue<a>) -> Queue<a>

Adds an item to the end of the queue.

Queue.dequeue

1
dequeue : Queue<a> -> Queue<a>

Removes the next item in the queue.

This is a notification!