[GHC] #13510: GHC panic with -fdefer-type-errors
GHC
ghc-devs at haskell.org
Sun Apr 2 08:03:36 UTC 2017
#13510: GHC panic with -fdefer-type-errors
-------------------------------------+-------------------------------------
Reporter: chrismwendt | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.2
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: Compile-time
Unknown/Multiple | crash or panic
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
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.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13510>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list