@@ -5,6 +5,35 @@ module Data.Sign
5||| A representation of signs for signed datatypes such as `ZZ`
5||| A representation of signs for signed datatypes such as `ZZ`
6data Sign = Plus | Zero | Minus
6data Sign = Plus | Zero | Minus
8+opposite : Sign -> Sign
13+multiply : Sign -> Sign -> Sign
14+multiply Zero _ = Zero
15+multiply _ Zero = Zero
17+multiply Minus x = opposite x
8||| Discover the sign of some type
19||| Discover the sign of some type
9interface Signed t where
20interface Signed t where
10 total sign : t -> Sign
21 total sign : t -> Sign
24+ sign x with (compare x 0)
30+ sign x with (compare x 0)
36+ sign x with (compare x 0.0)