Skip to content

restrictCoRec is unsound #171

Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions