Portability | to be determined. |
---|---|

Stability | highly unstable |

Maintainer | Stephen Tetley <stephen.tetley@gmail.com> |

A Join List datatype and operations.

Join Lists are symmetric lists where joining two lists (catenation, aka (++)) is a cheap operation. This constrasts with the regular list datatype which is a cons list: while consing on a regular list (building a list by adding an elementary prefix) is by nature cheap, joining (++) is expensive.

- data JoinList a
- fromList :: [a] -> JoinList a
- toList :: JoinList a -> [a]
- empty :: JoinList a
- singleton :: a -> JoinList a
- cons :: a -> JoinList a -> JoinList a
- snoc :: JoinList a -> a -> JoinList a
- (++) :: JoinList a -> JoinList a -> JoinList a
- join :: JoinList a -> JoinList a -> JoinList a
- null :: JoinList a -> Bool
- concat :: JoinList (JoinList a) -> JoinList a
- length :: JoinList a -> Int
- map :: (a -> b) -> JoinList a -> JoinList b
- replicate :: Int -> a -> JoinList a
- repeated :: Int -> JoinList a -> JoinList a
- gfold :: b -> (a -> b) -> (b -> b -> b) -> JoinList a -> b
- foldr :: (a -> b -> b) -> b -> JoinList a -> b
- foldl :: (b -> a -> b) -> b -> JoinList a -> b
- unfoldl :: (b -> Maybe (a, b)) -> b -> JoinList a
- unfoldr :: (b -> Maybe (a, b)) -> b -> JoinList a
- xzip :: JoinList a -> [b] -> JoinList (a, b)
- xzipWith :: (a -> b -> c) -> JoinList a -> [b] -> JoinList c

# Join list datatype, opaque.

# Conversion between join lists and regular lists

# Construction

(++) :: JoinList a -> JoinList a -> JoinList aSource

Catenate two join lists. Unlike (++) on regular lists,
catenation on join lists is (relatively) cheap hence the
name *join list*.

join :: JoinList a -> JoinList a -> JoinList aSource

An alias for (++) that does not cause a name clash with the Prelude.

# Basic functions

# Building join lists

repeated :: Int -> JoinList a -> JoinList aSource

Repeatedly build a join list by catenating the seed list.

# Generalized fold

gfold :: b -> (a -> b) -> (b -> b -> b) -> JoinList a -> bSource

A generalized fold, where each constructor has an operation.