Panic with valid hole fits + unsatisiable constraint
This program causes a panic in 9.4 and master:
{-# LANGUAGE DataKinds #-}
module M where
data F x
p :: forall r p. ((r ~ Just p) => F r) -> F r
p = undefined
q :: F Nothing
q = p _
panic! (the 'impossible' happened)
GHC version 9.4.3:
validHoleFits no evdest
[G] 'Nothing ~# 'Just p0_aKD[tau:1]
Alternatively:
module M where
p :: (Int ~ Bool => r) -> r
p = undefined
q :: r
q = p _
Credits to Sjoerd Visscher for finding the issue.