ghc 8.10 core dumps (add regression test)
I was implementing https://github.com/effectfully/sketches/blob/master/poly-type-of-saga/part1-try-unify/src/Main.hs and minor adjustments caused a Core Lint error in 8.10.0.20191123. It appears fixed in 9.1.0.20201202 but perhaps this is useful to add to a regression test. I have included the core-dump
{-# Language RankNTypes, TypeApplications, PolyKinds, DataKinds, TypeOperators, StandaloneKindSignatures, TypeFamilies, FlexibleInstances, MultiParamTypeClasses #-}
{-# Options_GHC -dcore-lint #-}
import Data.Type.Equality
import Data.Kind
type PolyKinded :: Type -> Type
type PolyKinded res = (forall (k :: Type). k -> res)
infix 4
===
type
(===) :: PolyKinded (PolyKinded Bool)
type family
a === b where
a === a = True
_ === _ = False
type TryUnify :: Bool -> forall k. k -> forall j. j -> Constraint
class (a === b) ~ cond
=> TryUnify cond a b
instance (a === b) ~ False
=> TryUnify False @k a @j b
instance {-# Incoherent #-}
( (a === b) ~ True
, a ~~ b
)
=> TryUnify True @k a @j b