hascard-0.6.0.2: A TUI for reviewing notes using 'flashcards' written with markdown-like syntax.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Stack

Synopsis

Documentation

type Stack a = OSet a Source #

fromList :: Ord a => [a] -> Stack a Source #

head :: Stack a -> a Source #

tail :: Ord a => Stack a -> [a] Source #

last :: Stack a -> a Source #

insert :: Ord a => a -> Stack a -> Stack a Source #

elemAt :: Stack a -> Int -> Maybe a Source #

removeLast :: Ord a => Stack a -> Stack a Source #

pop :: Ord a => Stack a -> Stack a Source #

popWithInfo :: Ord a => Stack a -> (Stack a, a, a) Source #

takeStack :: Ord a => Int -> Stack a -> Stack a Source #

toList :: Foldable t => t a -> [a] #

List of elements of a structure, from left to right. If the entire list is intended to be reduced via a fold, just fold the structure directly bypassing the list.

Examples

Expand

Basic usage:

>>> toList Nothing
[]
>>> toList (Just 42)
[42]
>>> toList (Left "foo")
[]
>>> toList (Node (Leaf 5) 17 (Node Empty 12 (Leaf 8)))
[5,17,12,8]

For lists, toList is the identity:

>>> toList [1, 2, 3]
[1,2,3]

Since: base-4.8.0.0