Importing doubly exported pattern synonym and associated pattern synonym panics
Given
{-# LANGUAGE PatternSynonyms, ViewPatterns #-}
module Pat (Vec2(Nil,(:>)), pattern (:>)) where
newtype Vec2 a = Vec2 {unvec2 :: [a]}
pattern Nil :: Vec2 a
pattern Nil = Vec2 []
pattern (:>) x xs <- ((\ys -> (head $ unvec2 ys,Vec2 . tail $ unvec2 ys)) -> (x,xs))
where
(:>) x xs = Vec2 (x:unvec2 xs)
and
{-# LANGUAGE PatternSynonyms #-}
module Main where
import Pat (Vec2(..),pattern (:>))
I get:
$ ghci Main.hs
GHCi, version 8.0.0.20160411: http://www.haskell.org/ghc/ :? for help
[1 of 2] Compiling Pat ( Pat.hs, interpreted )
Pat.hs:2:29: warning: [-Wduplicate-exports]
‘:>’ is exported by ‘(:>)’ and ‘Vec2(Nil, type (:>))’
[2 of 2] Compiling Main ( Main.hs, interpreted )
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.0.20160411 for x86_64-unknown-linux):
filterImports/combine
(:>, :>, Nothing)
(:>, Vec2{Vec2, :>, Nil}, Nothing)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Now, the warning about the duplicate export is of course correct. But the panic shouldn't happen when I try to import both the associated pattern synonym and the normal pattern synonym.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1-rc3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |