|
|
@@ -15,16 +15,6 @@ data Z |
|
|
|
data Nil |
|
|
|
data Cons h t |
|
|
|
|
|
|
|
class Not t b | t -> b |
|
|
|
instance Not True False |
|
|
|
instance Not False True |
|
|
|
|
|
|
|
class And a b r | a b -> r |
|
|
|
instance And True True True |
|
|
|
instance And True False False |
|
|
|
instance And False True False |
|
|
|
instance And False False False |
|
|
|
|
|
|
|
class Equal a b t | a b -> t |
|
|
|
instance Equal Z Z True |
|
|
|
instance Equal (S a) Z False |
|
|
@@ -53,10 +43,6 @@ class ThreeEnPlusOne x v | x -> v |
|
|
|
instance (Mul (S (S (S Z))) x Z i) |
|
|
|
=> ThreeEnPlusOne x (S i) |
|
|
|
|
|
|
|
class If c t f r | c t f -> r |
|
|
|
instance If True t f t |
|
|
|
instance If False t f f |
|
|
|
|
|
|
|
class EqOne x r | x -> r |
|
|
|
instance (Equal x (S Z) b) |
|
|
|
=> EqOne x b |
|
|
@@ -67,10 +53,6 @@ instance IsEven (S Z) False |
|
|
|
instance (IsEven n r) |
|
|
|
=> IsEven (S (S n)) r |
|
|
|
|
|
|
|
class IsOdd a b | a -> b |
|
|
|
instance (IsEven a i, Not i r) |
|
|
|
=> IsOdd a r |
|
|
|
|
|
|
|
class Branch b h n | b h -> n |
|
|
|
instance (Half h Z r) |
|
|
|
=> Branch True h r |
|
|
|