The following fails with Exception: matchNil: impossible
let intOrString :: CoRec Identity '[Int, String]
intOrString = CoRec (Identity "hello")
case restrictCoRec intOrString of
Left (Identity int) -> do
print int
Right definitelyString -> do
case restrictCoRec (definitelyString :: CoRec Identity '[String]) of
Left (Identity string) -> print string
Right uninhabited -> matchNil (uninhabited :: CoRec Identity '[])
Workaround: use restrictCoRecSafe instead of restrictCoRec.
The following fails with
Exception: matchNil: impossibleWorkaround: use
restrictCoRecSafeinstead ofrestrictCoRec.