Opened 8 months ago

Last modified 8 months ago

#16135 new bug

Panic with ExistentialQuantification and ApplicativeDo

Reported by: Ashley Yakeley Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.6.3
Keywords: ApplicativeDo Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash or panic Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by Ashley Yakeley)

{-# LANGUAGE ExistentialQuantification, ApplicativeDo #-}

module Bug where

data T f = forall a. MkT (f a)

runf :: forall f. Functor f => IO (T f)
runf = do
    return ()
    MkT fa <- runf
    return $ MkT fa
Bug.hs:11:18: error:ghc: panic! (the 'impossible' happened)
  (GHC version 8.6.3 for x86_64-unknown-linux):
	No skolem info:
  [a_a1nb[ssk:2]]
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
        pprPanic, called at compiler/typecheck/TcErrors.hs:2891:5 in ghc:TcErrors

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

Change History (3)

comment:1 Changed 8 months ago by Ashley Yakeley

Description: modified (diff)

comment:2 Changed 8 months ago by RyanGlScott

Keywords: ApplicativeDo added

comment:3 Changed 8 months ago by simonpj

I think the root cause of this is that the applicative-do stuff just doesn't work well with existentials. See the paper. The desugaring in Fig 5 really only works if the binder of the patterns don't include existentials.

To me that says:

  • GHC should check for this and complain if necessary. Not crash!
  • Someone might like to think about whether it'd be possible to accommodate existentials.

Simon M: this is your territory.

Note: See TracTickets for help on using tickets.