[GHC] #11959: Importing doubly exported pattern synonym and associated pattern synonym panics

GHC ghc-devs at haskell.org
Wed Apr 20 08:34:09 UTC 2016


#11959: Importing doubly exported pattern synonym and associated pattern synonym
panics
-------------------------------------+-------------------------------------
           Reporter:  darchon        |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.0.1
          Component:  Compiler       |           Version:  8.0.1-rc3
           Keywords:                 |  Operating System:  Unknown/Multiple
  PatternSynonyms                    |
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Given

 {{{#!hs
 {-# 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

 {{{#!hs
 {-# 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.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11959>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list