#3406: 'impossible' happened while messing around with ScopedTypeVariables
--------------------------------------------+-------------------------------
Reporter: RyanN | Owner: simonpj
Type: bug | Status: closed
Priority: normal | Milestone: 6.12.1
Component: Compiler | Version: 6.10.3
Severity: normal | Resolution: fixed
Keywords: ScopedTypeVariabes | Difficulty: Unknown
Testcase: typecheck/should_fail/T3406 | Os: Linux
Architecture: x86_64 (amd64) |
--------------------------------------------+-------------------------------
Changes (by simonpj):
* testcase: => typecheck/should_fail/T3406
* status: new => closed
* resolution: => fixed
Comment:
Good catch. The difficulty is that, in GHC's current type checker, scoped
type variables must be "rigid": that is, the type checker must know
exactly what they stand for, at their binding site.
My commit message for the fix contains a smaller example:
{{{
Tue Aug 25 08:30:59 GMT Daylight Time 2009 [email protected]
* Fix Trac #3406 (albeit not very satisfactorily): scoped type variables
The issue here is this:
type ItemColID a b = Int -- Discards a,b
get :: ItemColID a b -> a -> ItemColID a b
get (x :: ItemColID a b) = x :: ItemColID a b
The pattern signature for 'x' doesn't actually rigidly bind a,b.
This crashed GHC 6.10 with a 'readFilledBox' panic. Now we fail
with an error message
}}}
Although it's a corner case, GHC's restriction is a bit of a pain. With
the planned new "outside-in" type inference algorithm, however, this
problem will go away.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3406#comment:5>
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