Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 5.5k
    • Issues 5.5k
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 635
    • Merge requests 635
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Model experiments
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #11959

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
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking