This commit is contained in:
Shaun Kerr 2019-07-08 12:42:50 +12:00
parent 7797b8ff3f
commit 0ffedbb56f

38
boom.hs
View File

@ -69,43 +69,18 @@ class BoomOrNum n r | n -> r
instance (Map EqualThree' n bs, AnyTrue bs a, Boom' a n r)
=> BoomOrNum n r
data Nil
data Cons x xs
class First list x | list -> x
instance First Nil Nil
instance First (Cons x more) x
class ListConcat a b c | a b -> c
instance ListConcat Nil x x
instance (ListConcat as bs cs)
=> ListConcat (Cons a as) bs (Cons a cs)
class ListConcatAll ls l | ls -> l
instance ListConcatAll Nil Nil
instance (ListConcat chunk acc result,
ListConcatAll rest acc)
=> ListConcatAll (Cons chunk rest) result
class AnyTrue list t | list -> t
instance AnyTrue Nil False
instance AnyTrue (Cons True more) True
instance (AnyTrue list t)
=> AnyTrue (Cons False list) t
data Nil
data Cons x xs
data True
data False
class Not b1 b | b1 -> b
instance Not False True
instance Not True False
class Or b1 b2 b | b1 b2 -> b
instance Or True True True
instance Or True False True
instance Or False True True
instance Or False False False
data Z
data S n
@ -116,13 +91,6 @@ instance Equal Z (S b) False
instance (Equal a b t)
=> Equal (S a) (S b) t
class LessThan a b t | a b -> t
instance LessThan Z Z False
instance LessThan (S x) Z False
instance LessThan Z (S x) True
instance (LessThan a b t)
=> LessThan (S a) (S b) t
class Add x y z | x y -> z
instance Add x Z x
instance Add Z y y