#4875: ghc misdiagnoses a compile time error concerning parameterized types
---------------------------------+------------------------------------------
Reporter: Stef Joosten | Owner: simonpj
Type: bug | Status: new
Priority: normal | Milestone: 7.2.1
Component: Compiler | Version: 6.12.3
Keywords: | Testcase:
Blockedby: | Difficulty:
Os: Windows | Blocking:
Architecture: Unknown/Multiple | Failure: Other
---------------------------------+------------------------------------------
Changes (by igloo):
* owner: => simonpj
* milestone: => 7.2.1
Comment:
Thanks for the report.
GHC hasn't made a mistake as such. It's looked at the `Morphic` class,
which tells it that `Association`'s first parameter has kind `* -> *`, and
then looked at the `Association` class, which tries to use it with kind
`*`. It doesn't know that the first piece of information it found was the
wrong one.
You can give GHC more information, which allows it to give better errors:
If you add
{{{
{-# LANGUAGE KindSignatures #-}
}}}
at the top of the file, and change the class line to
{{{
class (Eq concept)=> Association (rel :: *) concept | rel -> concept where
}}}
then you get
{{{
q.hs:24:23:
`r' is applied to too many type arguments
In the type `r c -> [c]'
In the class declaration for `Morphic'
}}}
instead.
Simon, I don't know how easy it would be to improve the error? Perhaps,
assuming there is not context loop, it would be better for the typechecker
to process class bodies in dependency order?
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4875#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs