#3169: Bad occurs-check error message
----------------------------------------+-----------------------------------
Reporter: simonpj | Owner: chak
Type: bug | Status: reopened
Priority: normal | Milestone: 6.12.1
Component: Compiler (Type checker) | Version: 6.10.2
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Os: Unknown/Multiple
Architecture: Unknown/Multiple |
----------------------------------------+-----------------------------------
Changes (by simonpj):
* status: closed => reopened
* component: Compiler => Compiler (Type checker)
* resolution: worksforme =>
* summary: Type families occurs check => Bad occurs-check error message
Comment:
Darn! Silly me.
The error message is horrible though:
* In the call `(lookup a m)` there's a second error: looking up in `m`
requires a key of type `(a,b)` but `a::a`. So a more comprehensible error
might be "can't unify `a` with `(a,b)`". (Not an occurs-check, but
because 'a' is a skolem.) I think with our new "deferring" mechanism
we'll be able to defer occurs-check errors and report other errors first.
* The occurs-check itself is unhelpful. It should really say
{{{
Occurs check: cannot construct the infinite type: elt = Map b elt
Expected type: Maybe (Map b elt)
Inferred type: Maybe elt
In the expression: lookup a m :: Maybe (Map b elt)
}}}
Ie not `elt = t elt` but `elt = Map b elt`. And showing the
expected/inferred types would be helpful.
I'll re-open with a new title!
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3169#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