Skip to content

GHC panic caused by destructuring with qualified name

I have a cabal project with the following files:

-- src/Alt.hs
module Alt where

data Pizza = Pizza { filling :: String }

-- ===========
-- src/Main.hs
module Main where

import qualified Alt as A

data Pizza = Pizza { filling :: String }

unpizza :: A.Pizza -> String
-- to fix it, replace "filling" with "A.filling"
unpizza A.Pizza { filling = filling } = filling

main :: IO ()
main = putStrLn "Hello Haskell!"

Of course, this is not valid code. "filling" belongs to "Pizza" and "A.filling" belongs to "A.Pizza". But it causes a panic in GHC 8.2.1 instead of an error, so I suppose it is a bug. Can you reproduce this behavior?

Edit: GHC tells me:

<no location info>: error:

ghc: panic! (the 'impossible' happened) (GHC version 8.2.1 for x86_64-unknown-linux):

translateConPatVec: lookup

Edited by bloxx
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information