aboutsummaryrefslogtreecommitdiff
path: root/ch02_02.4-i.hs
blob: a3110968578874cc92f3f42b67ccb7ac179e01c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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