stgi-1.0.1: Educational implementation of the STG (Spineless Tagless G-machine)

Safe HaskellNone
LanguageHaskell2010

Data.Stack

Description

A simple stack type. Very similar to an ordinary list, but with a more specialized API.

Synopsis

Documentation

data Stack a Source

The usual stack data structure.

Constructors

Empty 
a :< (Stack a) 

forEachPop :: [x] -> Stack a -> Maybe ([a], Stack a) Source

For each list element, pop one element off the stack. Fail if not enough elements are on the stack.

(<>>) :: [a] -> Stack a -> Stack a Source

Push a list of items onto the stack. The first item will be at the top of the stack.

span :: (a -> Bool) -> Stack a -> (Stack a, Stack a) Source

Like span for lists.