[GHC] #10097: GHC 7.11 errors on dictionary casting tricks
GHC
ghc-devs at haskell.org
Tue Feb 17 13:43:46 UTC 2015
#10097: GHC 7.11 errors on dictionary casting tricks
-------------------------------------+-------------------------------------
Reporter: heisenbug | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.11
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by goldfire):
I don't like that there's been a typechecker regression here, but this
doesn't seem like an outright bug to me. The one bit I'm quite unsure of
is the eta-contraction... and my reasoning-about-higher-rank-eta-
contracted-functions neuron seems to be enjoying the snow day here. So
I'll eta-expand:
{{{
iFeelDirty x = unsafeCoerce x
}}}
Now, I can see why your error appears. When you say `x`, GHC will try to
instantiate the implicit parameters of `x`, namely `ts` and `List f ts`.
But, GHC has no guidance as to what these should be, because it can't
glean anything useful from `unsafeCoerce`. Some more type annotations
might be helpful, as might be newtype wrappers to accurately control what
you're `unsafeCoerce`ing.
So, I have two conclusions:
* I'm happy enough with an error in the eta-expanded version, but I agree
that the eta-contracted one should probably work.
* I don't think this bug shows up a problem with the dirty dictionary-
casting trick. That should still be valid. It's just a typechecker
behavior change, which (I believe) could be overcome with more types.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10097#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list