Skip to content

Backpack & PolyKinds: flatten_args wandered into deeper water than usual

Summary

While trying to implement PrimMonad with Backpack I ran into this error message:

ghc: panic! (the 'impossible' happened)
  (GHC version 8.10.4:
	flatten_args wandered into deeper water than usual
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1179:37 in ghc:Outputable
        pprPanic, called at compiler/typecheck/TcFlatten.hs:1029:21 in ghc:TcFlatten

Steps to reproduce

-- prim.bkp
{-# LANGUAGE PolyKinds #-}

unit prim-indef where
  signature PrimMonad where
    data PrimMonad s a
    instance Monad (PrimMonad s)

unit prim-st where
  module PrimST where
    import GHC.ST
    type PrimMonad s = ST s

unit main where
  dependency prim-indef[PrimMonad=prim-st:PrimST]
  module Main where
    main = print "Hello, World!"

Run ghc --backpack prim.bkp.

Expected behavior

No panic.

Environment

  • GHC version used: 8.10.4
Edited by Jaro Reinders
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information