#12109 closed bug (duplicate)

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

Reported by: Iceland_jack Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.0.1
Keywords: PatternSynonyms Cc: mpickering
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: #12007 Differential Rev(s):
Wiki Page:

Description

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

> 

Change History (2)

comment:1 Changed 15 months ago by Iceland_jack

$ ghci -ignore-dot-ghci
GHCi, version 8.0.0.20160511: http://www.haskell.org/ghc/  :? for help
Prelude> :set -XPatternSynonyms 
Prelude> :set -XViewPatterns 
Prelude> pattern Parsed x = [(x, "")]
Prelude> pattern Read a <- (reads -> Parsed a)
Prelude> let Read x = "420" in (x::Int)
420

works

comment:2 Changed 15 months ago by mpickering

Resolution: duplicate
Status: newclosed

This is the same as #12007

Note: See TracTickets for help on using tickets.