1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeOperators #-}
module Data.Type.Bool where
data TrueType
data FalseType
type family If cond tru fls where
If TrueType tru fls = tru
If FalseType tru fls = fls
type family AndType a b where
AndType FalseType b = FalseType
AndType TrueType b = TrueType
AndType a FalseType = FalseType
AndType a TrueType = TrueType
AndType a a = a
-- infixr 2 &&
type family OrType a b where
OrType FalseType a = a
OrType TrueType a = TrueType
OrType a FalseType = a
OrType a TrueType = TrueType
OrType a a = a
-- infixr 2 ||
type family Not a where -- Not a = res | res -> a
Not FalseType = TrueType
Not TrueType = FalseType
|