module DList where newtype DList a = DL ([a] -> [a]) fromDList :: DList a -> [a] fromDList (DL f) = f [] singleton :: a -> DList a singleton c = DL (c:) empty :: DList a empty = DL id (+++) :: DList a -> DList a -> DList a DL f +++ DL g = DL (f . g)