ImpredicativeTypes causes GHC panic with 8.0.1-rc1
I noticed this issue when attempting to compile conduit
with GHC 8.0.1-rc1 (specifically, the Data.Conduit.Internal.Pipe module). This (greatly simplified) code, which compiles without issue on GHC 7.10.3:
{-# LANGUAGE ImpredicativeTypes #-}
module Data.Conduit.Internal.Pipe where
data Pipe o r =
HaveOutput (Pipe o r) o
mapOutputMaybe :: (o1 -> Maybe o2) -> Pipe o1 r -> Pipe o2 r
mapOutputMaybe f (HaveOutput p o) =
maybe id (\o' p' -> HaveOutput p' o') (f o) (mapOutputMaybe f p)
emits a GHC panic with GHC 8.0.1-rc1:
[1 of 1] Compiling Data.Conduit.Internal.Pipe ( Wat.hs, interpreted )
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.0.20160111 for x86_64-unknown-linux):
matchExpectedFunTys
<>
a_a15Z[tau:5] -> b_a15Y[tau:5]
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Note that this code does not require -XImpredicativeTypes
, and removing the pragma makes the code compile again.
Marking as high since it's a regression, but not highest because -XImpredicativeTypes
has long been broken (see also #11319 (closed)). Still, this currently happens on code in the wild, and perhaps it would be worth turning this into a more sensible error.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1-rc1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | high |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |