[GHC] #16114: strange "instance .. => .. => .. where ..."

GHC ghc-devs at haskell.org
Mon Dec 31 15:02:07 UTC 2018


#16114: strange "instance .. => .. => .. where ..."
-------------------------------------+-------------------------------------
           Reporter:  j.waldmann     |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.6.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 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
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16114>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list