aboutsummaryrefslogtreecommitdiff
path: root/ch10_10.4-i.hs
blob: 3e7606ac963dfd11fb5928765bf89f1c01758b84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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))