aboutsummaryrefslogtreecommitdiff
path: root/ch02_02.4-i.hs
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2025-01-03 11:01:20 -0800
committerPaul Oliver <contact@pauloliver.dev>2025-01-05 09:59:10 -0800
commit6a0d7f5c434c3564d0119befb6799fd77581050a (patch)
treef20bc998290211d2a895523417ad32e297b31af0 /ch02_02.4-i.hs
InitialHEADmaster
Diffstat (limited to 'ch02_02.4-i.hs')
-rw-r--r--ch02_02.4-i.hs14
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