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

Deprecated: Please use Stack.peek instead. Stack.head will be removed in v0.4.0.

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.

Stack.size

1
size : Stack<a> -> Number

Computes the size of the input stack.

This is a notification!