Created
August 24, 2018 03:55
-
-
Save higherorderfunctor/4382803a7a71347c1c828a5f2be3761e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data EitherOr a b = | |
Hello a | |
| Goodbye b | |
instance (Eq a, Eq b) => Eq (EitherOr a b) where | |
(==) (Hello a) (Hello a') = | |
a == a' | |
(==) (Goodbye b) (Goodbye b') = | |
b == b' | |
(==) _ _ = False | |
λ> Hello "a" == Hello "a" | |
<interactive>:38:1: warning: [-Wtype-defaults] | |
• Defaulting the following constraint to type ‘()’ | |
Eq b0 arising from a use of ‘==’ | |
• In the expression: Hello "a" == Hello "a" | |
In an equation for ‘it’: it = Hello "a" == Hello "a" | |
<interactive>:38:1: warning: [-Wtype-defaults] | |
• Defaulting the following constraint to type ‘()’ | |
Eq b0 arising from a use of ‘==’ | |
• In the expression: Hello "a" == Hello "a" | |
In an equation for ‘it’: it = Hello "a" == Hello "a" | |
True | |
*TypeClasses1 | |
λ> (Hello "a" :: EitherOr String ()) == (Hello "a" :: EitherOr String ()) | |
True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment