Append one list to another in constant time.
Prepend a single element in constant time.
Append a single element in constant time.
Map over a difference list, then flatten.
Fold over a difference list.
Get the first element of the list, if any.
Tests whether list is empty.
Map over a difference list.
Get the tail of the list, if any.
Convert to a normal list.
List elimination of head and tail.
Get the first element of the list.
Get the first element of the list.
(Since version 7.1.0) unsafe; use headOption
Get the tail of the list.
Get the tail of the list.
(Since version 7.1.0) unsafe; use tailOption
Difference lists: a data structure for
O(1)
append on lists. Based onData.DList
, a Haskell library by Don Stewart.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, making it very useful for append-heavy uses, such as logging and pretty printing.