Copyright | (c) Artem Mavrin 2021 |
---|---|
License | BSD3 |
Maintainer | artemvmavrin@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe |
Language | Haskell2010 |
Simple difference list implementation. Difference lists are an abstraction
that enables constant-time concatenation of lists using function composition.
This is a generalization of the ShowS
type.
Documentation
type DList a = [a] -> [a] Source #
Difference list. See https://wiki.haskell.org/Difference_list.
Difference lists are concatenated by function composition.
>>>
d1 = fromList [1, 2, 3]
>>>
d2 = fromList [4, 5, 6]
>>>
d3 = fromList [7, 8, 9]
>>>
toList (d1 . d2 . d3)
[1,2,3,4,5,6,7,8,9]