diff options
Diffstat (limited to 'ch02_02.4-i.hs')
-rw-r--r-- | ch02_02.4-i.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ch02_02.4-i.hs b/ch02_02.4-i.hs new file mode 100644 index 0000000..a311096 --- /dev/null +++ b/ch02_02.4-i.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE DataKinds #-} + +-- Exercise 2.4-i +-- Write a closed type family to compute `Not`. + +-- I use my own boolean data type and generated kinds. But it's the same as +-- just using plain `Bool`: +data MyBool + = MyTrue + | False + +type family Not (x :: MyBool) :: MyBool where + Not 'MyTrue = 'MyFalse + Not 'MyFalse = 'MyTrue |