coerce can cause compiler to loop
This program causes GHC to loop at compile time
{-# LANGUAGE ScopedTypeVariables #-}
import Data.Coerce
coerce' :: Coercible b a => a -> b
coerce' = coerce (\x -> x :: b) :: forall a b. Coercible b a => a -> b
I encountered this trying to use a similar construction in
https://github.com/glguy/profunctors/blob/coerce/src/Data/Profunctor/Unsafe.hs
I'm not absolutely certain about what aspect of this snippet is looping the compiler, but it's pretty small.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.10.1-rc1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |