aboutsummaryrefslogtreecommitdiff
path: root/ch10_10.4-i.hs
diff options
context:
space:
mode:
Diffstat (limited to 'ch10_10.4-i.hs')
-rw-r--r--ch10_10.4-i.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/ch10_10.4-i.hs b/ch10_10.4-i.hs
new file mode 100644
index 0000000..3e7606a
--- /dev/null
+++ b/ch10_10.4-i.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE TypeFamilies #-}
+
+-- Exercise 10.4-i
+-- Write a promoted functor instance for tuples.
+
+import Data.Kind (Type)
+
+type Exp a = a -> Type
+
+type family Eval (e :: Exp a) :: a
+
+data Map :: (a -> Exp b) -> f a -> Exp (f b)
+
+type instance Eval (Map f '(a, b)) = '(a, Eval (f b))