Browse files

Added instance Eq Bool

Noticed that I had to extend the context for (==) because I used `not`, seems a bit bad...
  • Loading branch information...
1 parent 01fac77 commit 3d479a1d84dac6de1115438f9a571bd2f1a75253 @tomlokhorst committed Jan 21, 2010
Showing with 11 additions and 2 deletions.
  1. +11 −2 src/Generic/Data/Eq.hs
View
13 src/Generic/Data/Eq.hs
@@ -8,6 +8,15 @@ import Generic.Data.Bool
infix 4 ==, /=
class Eq j a where
- (==) :: j a -> j a -> j Bool
- (/=) :: j a -> j a -> j Bool
+ (==) :: (BoolC j) => j a -> j a -> j Bool
+ (/=) :: (BoolC j) => j a -> j a -> j Bool
+
+ x /= y = not (x == y)
+ x == y = not (x /= y)
+
+instance (BoolC j) => Eq j Bool where
+ x == y = if' x y (not y)
+
+z :: (BoolC j) => j Bool
+z = true == false

0 comments on commit 3d479a1

Please sign in to comment.