• Richard Eisenberg's avatar
    Fix #12369 by being more flexible with data insts · 42392383
    Richard Eisenberg authored
    Previously, a data family's kind had to end in `Type`,
    and data instances had to list all the type patterns for the
    family. However, both of these restrictions were unnecessary:
    - A data family's kind can usefully end in a kind variable `k`.
      See examples on #12369.
    - A data instance need not list all patterns, much like how a
      GADT-style data declaration need not list all type parameters,
      when a kind signature is in place. This is useful, for example,
        data family Sing (a :: k)
        data instance Sing :: Bool -> Type where ...
    This patch also improved a few error messages, as some error
    plumbing had to be moved around.
    See new Note [Arity of data families] in FamInstEnv for more
    test case: indexed-types/should_compile/T12369
TcHsType.hs 93.8 KB