#2516: Panic in typechecker when checking rules
-------------------------------------+--------------------------------------
Reporter: josef | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler (Type checker) | Version: 6.8.2
Severity: normal | Resolution: duplicate
Keywords: | Difficulty: Unknown
Testcase: | Architecture: x86
Os: Linux |
-------------------------------------+--------------------------------------
Changes (by simonpj):
* status: new => closed
* difficulty: => Unknown
* resolution: => duplicate
Comment:
Several things going on here. First, I've already fixed a bug in
typechecking for rules, so it doesn't crash any more. Second, see #2497;
you need `-XScopedTypeVariables -XRankNTypes -XPatternSignatures`; that
will improve shortly. At that point, with the HEAD and those flags we
get:
{{{
T2516.hs:9:15:
Couldn't match expected type `[]' against inferred type `f'
`f' is a rigid type variable bound by
the type signature for `g' at T2516.hs:8:23
In the first argument of `foo', namely `g'
In the first argument of `head', namely `(foo g)'
When checking the transformation rule "bug1"
T2516.hs:9:15:
Couldn't match expected type `a1' against inferred type `a'
`a1' is a rigid type variable bound by
the polymorphic type `forall a1. a1 -> [a1]' at T2516.hs:9:11
`a' is a rigid type variable bound by
the type signature for `g' at T2516.hs:8:18
In the first argument of `foo', namely `g'
In the first argument of `head', namely `(foo g)'
When checking the transformation rule "bug1"
}}}
And indeed that's right. What you wanted in `GHCBug1` is this:
{{{
{-# RULES
"bug1"
forall (g :: forall a. a -> [a]) .
head (foo g) = undefined
#-}
}}}
Note the `forall` in the type of `g`, and the `[a]` instead of `f a`.
Then all is cool.
So I'll close this as a dup of #2497.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2516#comment:1>
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