Portability | portable (Haskell 98) |
---|---|

Stability | experimental |

Maintainer | dons@cse.unsw.edu.au |

Difference lists: a data structure for O(1) append on lists.

- data DList a
- fromList :: [a] -> DList a
- toList :: DList a -> [a]
- empty :: DList a
- singleton :: a -> DList a
- cons :: a -> DList a -> DList a
- snoc :: DList a -> a -> DList a
- append :: DList a -> DList a -> DList a
- concat :: [DList a] -> DList a
- list :: b -> (a -> DList a -> b) -> DList a -> b
- head :: DList a -> a
- tail :: DList a -> DList a
- unfoldr :: (b -> Maybe (a, b)) -> b -> DList a
- foldr :: (a -> b -> b) -> b -> DList a -> b
- map :: (a -> b) -> DList a -> DList b

# Documentation

A difference list is a function that given a list, returns the original contents of the difference list prepended at the given list

This structure supports *O(1)* append and snoc operations on lists.