diff options
Diffstat (limited to 'ch10_10.0.example.hs')
-rw-r--r-- | ch10_10.0.example.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ch10_10.0.example.hs b/ch10_10.0.example.hs new file mode 100644 index 0000000..2ab1d84 --- /dev/null +++ b/ch10_10.0.example.hs @@ -0,0 +1,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 |