Skip to content

Matching on pattern synonym succeeds compiled with ghc, fails with ghci

A file /tmp/test.hs

{-# Language PatternSynonyms, ViewPatterns #-}

pattern Parsed x = [(x, "")]
pattern Read a <- (reads -> Parsed a)

main = do
  let Read x = "420"
  print (x::Int)
$ ghc -ignore-dot-ghci /tmp/test.hs && /tmp/test 
420

fails with ghci

$ ghci -ignore-dot-ghci /tmp/test.hs 
GHCi, version 8.0.0.20160511: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( /tmp/test.hs, interpreted )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.0.0.20160511 for x86_64-unknown-linux):
        kindPrimRep.go rep_a1XC

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

> 
Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC mpickering
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information