Skip to content

strange "instance .. => .. => .. where ..."

I don't understand what's happening here:

GHCi, version 8.6.3: http://www.haskell.org/ghc/  :? for help
Prelude> data T a
Prelude> instance Eq a => Eq a => Eq (T a) where (==) = undefined

<interactive>:2:10: error:
    • Class ‘Eq’ does not have a method ‘==’
    • In the instance declaration for ‘Eq (T a)’

Is that even syntactically correct? (ghc-8.4.4 says "malformed instance") If so, then I'd assume that A => B => C means A && B => C, that is, (A,B) => C in this case, but it does not, since this works:

instance (Eq a, Eq a)=> Eq (T a) where (==) = undefined
Trac metadata
Trac field Value
Version 8.6.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information