summaryrefslogtreecommitdiff
path: root/utils/mkUserGuidePart/DList.hs
blob: c4b9283e52be0ca07fdb9ae4bfb0ab5687f48ece (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
module DList where

newtype DList a = DList ([a] -> [a])

snoc :: DList a -> a -> DList a
DList f `snoc` x = DList (f . (x:))

toList :: DList a -> [a]
toList (DList f) = f []

instance Monoid (DList a) where
  mempty = DList id
  DList a `mappend` DList b = DList (a . b)