GHC panic with -fdefer-type-errors
This program causes GHCi to panic:
import Data.Monoid
a = ""
x :: () -> Int
x b = a <> b
$ stack --version
Version 1.3.2 x86_64 hpack-0.15.0
$ stack exec ghci program.hs
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /Users/chrismwendt/.ghci
[1 of 1] Compiling Main ( program.hs, interpreted )
program.hs:6:12: warning: [-Wdeferred-type-errors]
• Couldn't match expected type ‘Int’ with actual type ‘()’
• In the second argument of ‘(<>)’, namely ‘b’
In the expression: a <> b
In an equation for ‘x’: x b = a <> b
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-apple-darwin):
corePrepPgm
[False] cobox_r1MZ = typeError
@ 'VoidRep
@ (Int :: *) ~# (() :: *)
"program.hs:6:12: error:\n\
\ \\226\\128\\162 Couldn't match expected type \\226\\128\\152Int\\226\\128\\153 with actual type \\226\\128\\152()\\226\\128\\153\n\
\ \\226\\128\\162 In the second argument of \\226\\128\\152(<>)\\226\\128\\153, namely \\226\\128\\152b\\226\\128\\153\n\
\ In the expression: a <> b\n\
\ In an equation for \\226\\128\\152x\\226\\128\\153: x b = a <> b\n\
\(deferred type error)"#
Here's my ~/.ghci config:
:set -fdefer-type-errors
:set -XOverloadedStrings
:set +t
Both -fdefer-type-errors and -XOVerloadedStrings are necessary to cause the panic.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |