"No skolem info"
On GHC 8.6.3, I am trying to typecheck the following code:
{-# LANGUAGE RankNTypes, TypeFamilies, PolyKinds, FunctionalDependencies #-}
import Data.Kind
class CatMonad (c :: k -> k -> Type) (m :: forall (x :: k) (y :: k). c x y -> Type -> Type) | c -> m where
type Id c :: c x x
xpure :: a -> m (Id c) a
boom :: forall (c :: k -> k -> Type) (m :: forall (x :: k) (y :: k). c x y -> Type -> Type) a. CatMonad c m => a -> m (Id c) a
boom = xpure
GHC panics with the following error message:
error:ghc: panic! (the 'impossible' happened) (GHC version 8.6.3 for x86_64-unknown-linux): No skolem info: [k_a2vT[sk:0]] 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
If you're thinking, "oh my god, why would you write code like that?!?!?!", the background is this Stack Overflow answer, and specifically, pining for overriding return
and (>>=)
using RebindableSyntax
to be able to use do
-notation with (category-)indexed monads.