Commit ab41a6cb authored by Steffen Michels's avatar Steffen Michels

add == and < instance for ()

parent dfe469d7
......@@ -19,9 +19,11 @@ snd3 tuple :== t2 where (_, t2, _) = tuple
// thd3 :: !(.a,.b,!.c) -> .c // t3 of (t1,t2,t3)
thd3 tuple :== t3 where (_, _, t3) = tuple
instance == () :: !() !() -> Bool :== code { pop_a 2 ; pushB TRUE }
instance == (a,b) | Eq a & Eq b :: !(!a,b) !(!a,b) -> Bool | Eq a & Eq b
instance == (a,b,c) | Eq a & Eq b & Eq c :: !(!a,b,c) !(!a,b,c) -> Bool | Eq a & Eq b & Eq c
instance < () :: !() !() -> Bool :== code { pop_a 2 ; pushB FALSE }
instance < (a,b) | Ord a & Ord b :: !(!a,b) !(!a,b) -> Bool | Ord a & Ord b
instance < (a,b,c) | Ord a & Ord b & Ord c :: !(!a,b,c) !(!a,b,c) -> Bool | Ord a & Ord b & Ord c
......
......@@ -21,6 +21,10 @@ snd3 tuple :== t2 where (_, t2, _) = tuple
// thd3 :: !(.a,.b,!.c) -> .c // t3 of (t1,t2,t3)
thd3 tuple :== t3 where (_, _, t3) = tuple
instance == () where
(==) :: !() !() -> Bool
(==) _ _ = code inline { pop_a 2 ; pushB TRUE }
instance == (a,b) | Eq a & Eq b
where
(==) ::!(!a,b) !(!a,b) -> Bool | Eq a & Eq b
......@@ -31,6 +35,10 @@ instance == (a,b,c) | Eq a & Eq b & Eq c
(==) ::!(!a,b,c) !(!a,b,c) -> Bool | Eq a & Eq b & Eq c
(==) (x1,y1,z1) (x2,y2,z2) = x1==x2 && y1==y2 && z1==z2
instance < () where
(<) :: !() !() -> Bool
(<) _ _ = code inline { pop_a 2 ; pushB FALSE }
instance < (a,b) | Ord a & Ord b
where
(<) ::!(!a,b) !(!a,b) -> Bool | Ord a & Ord b
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment