summaryrefslogtreecommitdiff
path: root/utils/mkUserGuidePart/DList.hs
diff options
context:
space:
mode:
Diffstat (limited to 'utils/mkUserGuidePart/DList.hs')
-rw-r--r--utils/mkUserGuidePart/DList.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/utils/mkUserGuidePart/DList.hs b/utils/mkUserGuidePart/DList.hs
new file mode 100644
index 0000000000..c4b9283e52
--- /dev/null
+++ b/utils/mkUserGuidePart/DList.hs
@@ -0,0 +1,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)