git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Eq instances for Maybe and Either
60560bdPhil Freeman
prelude/prelude.purs+12
@@ -425,6 +425,12 @@ module Data.Maybe where
425 show (Just x) = "Just " ++ (show x)
425 show (Just x) = "Just " ++ (show x)
426 show Nothing = "Nothing"
426 show Nothing = "Nothing"
427
427
428+ instance eqMaybe :: (Eq a) => Eq (Maybe a) where
429+ (==) Nothing Nothing = true
430+ (==) (Just a1) (Just a2) = a1 == a2
431+ (==) _ _ = false
432+ (/=) a b = not (a == b)
433+
428module Data.Either where
434module Data.Either where
429
435
430 import Prelude
436 import Prelude
@@ -452,6 +458,12 @@ module Data.Either where
452 show (Left x) = "Left " ++ (show x)
458 show (Left x) = "Left " ++ (show x)
453 show (Right y) = "Right " ++ (show y)
459 show (Right y) = "Right " ++ (show y)
454
460
461+ instance eqEither :: (Eq a, Eq b) => Eq (Either a b) where
462+ (==) (Left a1) (Left a2) = a1 == a2
463+ (==) (Right b1) (Right b2) = b1 == b2
464+ (==) _ _ = false
465+ (/=) a b = not (a == b)
466+
455module Data.Array where
467module Data.Array where
456
468
457 import Prelude
469 import Prelude