From 6a0d7f5c434c3564d0119befb6799fd77581050a Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Fri, 3 Jan 2025 11:01:20 -0800 Subject: Initial --- ch02_02.4-i.hs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 ch02_02.4-i.hs (limited to 'ch02_02.4-i.hs') 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 -- cgit v1.2.1