Skip to content

mightEqualLater finds an unbound cbv

Summary

The file Bug.hs produces

{-# LANGUAGE
    DataKinds,
    GADTs,
    QuantifiedConstraints,
    TypeFamilies
  #-}

module Bug where

type family Foo x where
  Foo (Maybe a) = a

data Bug1 a b c where
  Bug1 :: (a ~ 'True => Show b, a ~ 'False => Show c) => Bug1 a b c

data Bug2 f a b where
  Bug2 :: (a ~ 'True => f b) => Bug2 f a b

bug :: b ~ Maybe (Foo b) => Bug2 Show a (Foo b) -> Bug1 a (Foo b) Int
bug Bug2 = Bug1
ghc: panic! (the 'impossible' happened)
  (GHC version 9.2.0.20210422:
        mightEqualLater finds an unbound cbv
  cbv_aLN[cbv:1]
  []
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/GHC/Utils/Panic.hs:181:37 in ghc:GHC.Utils.Panic
        pprPanic, called at compiler/GHC/Tc/Solver/Monad.hs:2558:16 in ghc:GHC.Tc.Solver.Monad

Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

Steps to reproduce

Run ghci Bug.

Expected behavior

File should type check successfully.

Environment

  • GHC version used: 9.2.1-alpha2 (9.2.0.20210422)

Optional:

  • Operating System: Arch Linux
  • System Architecture: x86-64
Edited by Matthew Pickering
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information