aboutsummaryrefslogtreecommitdiff
path: root/ch10_10.0.example.hs
blob: 2ab1d841fba946ace844fa0df5454817ad47cbc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}

import Data.Kind (Type)

type Exp a = a -> Type

type family Eval (e :: Exp a) :: a

data Fst :: (a, b) -> Exp a

data Snd :: (a, b) -> Exp b

type instance Eval (Fst '(a, b)) = a

type instance Eval (Snd '(a, b)) = b