Skip to content
  • 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,
      here:
    
        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
    info.
    
    test case: indexed-types/should_compile/T12369
    42392383