Stack

GitHub   Edit on GitHub

An immutable stack implementation. A stack is a LIFO (last-in-first-out) data structure where new values are added, retrieved, and removed from the end.


Values

Stack.make

1
make : () -> Stack<a>

Creates a new stack.

Stack.isEmpty

1
isEmpty : Stack<a> -> Bool

Checks if the given stack contains no items.

Stack.head

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

Returns Some(item) where item is the value at the top of the stack, and None otherwise.

Stack.push

1
push : (a, Stack<a>) -> Stack<a>

Adds a new item to the top of the stack.

Stack.pop

1
pop : Stack<a> -> Stack<a>

Removes the item at the top of the stack.

This is a notification!