My expectation is that the code sample below ought to compile
testOptionalEq = None == None
testEitherEq = Left 1 == Left 1
testOptionalShow = show None
testEitherShow = show (Left 1)
and yet each line results in a compilation error, either
Ambiguous type variable `a1' arising from a use of `=='
prevents the constraint `(Eq a1)' from being solved.
Probable fix: use a type annotation to specify what `a1' should be.
or
Ambiguous type variable `a0' arising from a use of `show'
prevents the constraint `(Show a0)' from being solved.
Probable fix: use a type annotation to specify what `a0' should be.
Trying similar looking Haskell code in ghci
works. One workaround is to give the values explicit type signatures (e.g. None : Optional Int
), but it would be great if it worked without that.