Commit d644e7f3 authored by johnvg@science.ru.nl's avatar johnvg@science.ru.nl

add strictness annotations to instances of == and < for tuples

parent 7ed30c4c
...@@ -19,11 +19,11 @@ snd3 tuple :== t2 where (_, t2, _) = tuple ...@@ -19,11 +19,11 @@ snd3 tuple :== t2 where (_, t2, _) = tuple
// thd3 :: !(.a,.b,!.c) -> .c // t3 of (t1,t2,t3) // thd3 :: !(.a,.b,!.c) -> .c // t3 of (t1,t2,t3)
thd3 tuple :== t3 where (_, _, t3) = tuple thd3 tuple :== t3 where (_, _, t3) = tuple
instance == (a,b) | Eq a & Eq b 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 instance == (a,b,c) | Eq a & Eq b & Eq c :: !(!a,b,c) !(!a,b,c) -> Bool | Eq a & Eq b & Eq c
instance < (a,b) | Ord a & Ord b 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 instance < (a,b,c) | Ord a & Ord b & Ord c :: !(!a,b,c) !(!a,b,c) -> Bool | Ord a & Ord b & Ord c
app2 :: !(.(.a -> .b),.(.c -> .d)) !(.a,.c) -> (.b,.d) // app2 (f,g) (a,b) = (f a,g b) app2 :: !(.(.a -> .b),.(.c -> .d)) !(.a,.c) -> (.b,.d) // app2 (f,g) (a,b) = (f a,g b)
app3 :: !(.(.a -> .b),.(.c -> .d),.(.e -> .f)) !(.a,.c,.e) -> (.b,.d,.f) app3 :: !(.(.a -> .b),.(.c -> .d),.(.e -> .f)) !(.a,.c,.e) -> (.b,.d,.f)
......
...@@ -23,17 +23,17 @@ thd3 tuple :== t3 where (_, _, t3) = tuple ...@@ -23,17 +23,17 @@ thd3 tuple :== t3 where (_, _, t3) = tuple
instance == (a,b) | Eq a & Eq b instance == (a,b) | Eq a & Eq b
where where
(==) ::!(a,b) !(a,b) -> Bool | Eq a & Eq b (==) ::!(!a,b) !(!a,b) -> Bool | Eq a & Eq b
(==) (x1,y1) (x2,y2) = x1==x2 && y1==y2 (==) (x1,y1) (x2,y2) = x1==x2 && y1==y2
instance == (a,b,c) | Eq a & Eq b & Eq c instance == (a,b,c) | Eq a & Eq b & Eq c
where where
(==) ::!(a,b,c) !(a,b,c) -> Bool | 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 (==) (x1,y1,z1) (x2,y2,z2) = x1==x2 && y1==y2 && z1==z2
instance < (a,b) | Ord a & Ord b instance < (a,b) | Ord a & Ord b
where where
(<) ::!(a,b) !(a,b) -> Bool | Ord a & Ord b (<) ::!(!a,b) !(!a,b) -> Bool | Ord a & Ord b
(<) (x1,y1) (x2,y2) (<) (x1,y1) (x2,y2)
| x1<x2 | x1<x2
= True = True
...@@ -44,7 +44,7 @@ instance < (a,b) | Ord a & Ord b ...@@ -44,7 +44,7 @@ instance < (a,b) | Ord a & Ord b
instance < (a,b,c) | Ord a & Ord b & Ord c instance < (a,b,c) | Ord a & Ord b & Ord c
where where
(<) ::!(a,b,c) !(a,b,c) -> Bool | Ord a & Ord b & Ord c (<) ::!(!a,b,c) !(!a,b,c) -> Bool | Ord a & Ord b & Ord c
(<) (x1,y1,z1) (x2,y2,z2) (<) (x1,y1,z1) (x2,y2,z2)
| x1<x2 | x1<x2
= True = True
......
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