[GHC] #14561: Panic on levity polymorphic very unsafe coerce
GHC
ghc-devs at haskell.org
Thu Dec 7 14:53:47 UTC 2017
#14561: Panic on levity polymorphic very unsafe coerce
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.3
Resolution: | Keywords:
| LevityPolymorphism
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by goldfire):
I strongly prefer the latter. It makes me nervous not to have a true back-
door to the type system (which we would lose if we dropped the levity-
polymorphism from `unsafeCoerce#`).
It should be easy enough to check for saturation in the desugarer.
But, actually, there's a third option:
* Allow silly uses of `unsafeCoerce#` to cause a panic.
The user is clearly taking on the risk of a runtime crash with
`unsafeCoerce#`. We could just say they also risk taking on a compile-time
crash. In this case, I think the fix (the saturation check) is easy
enough, but I don't feel strongly committed to eradicating a hard-to-fix
panic if the user abuses the type system with such a low-level operation.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14561#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list