summaryrefslogtreecommitdiff
path: root/functor/h3.hs
diff options
context:
space:
mode:
Diffstat (limited to 'functor/h3.hs')
-rw-r--r--functor/h3.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/functor/h3.hs b/functor/h3.hs
new file mode 100644
index 0000000..1a048f6
--- /dev/null
+++ b/functor/h3.hs
@@ -0,0 +1,6 @@
+data ITree a =
+ Leaf (Int -> a) | Node [ITree a]
+
+instance Functor ITree where
+ fmap f (Node x) = Node (fmap (fmap f) x)
+ fmap f (Leaf x) = Leaf (f.x)