[GHC] #12792: Wrong error message when using a data type as a class instance head
GHC
ghc-devs at haskell.org
Mon Oct 31 21:18:44 UTC 2016
#12792: Wrong error message when using a data type as a class instance head
-------------------------------------+-------------------------------------
Reporter: nomeata | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.1
Keywords: newcomer | Operating System: Unknown/Multiple
Architecture: | Type of failure: Incorrect
Unknown/Multiple | error/warning at compile-time
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
{{{
Prelude> data List a = Nil | Cons a (List a)
Prelude> instance List a
<interactive>:3:10: error:
• Expected a constraint, but ‘List a’ has kind ‘*’
• In the instance declaration for ‘List a’
Prelude> instance List a where foo = foo
<interactive>:2:23: error:
‘foo’ is not a (visible) method of class ‘List’
}}}
Clearly, the constraint check should happen before we look at the method
names.
Happens with 7.10 and 8.0.1 and HEAD.
Shouldn’t be hard, marking at newcomer.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12792>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list