• Simon Peyton Jones's avatar
    Fix typechecking for pattern synonym signatures · f40e122b
    Simon Peyton Jones authored
    Various tickets have revealed bad shortcomings in the typechecking of
    pattern type synonyms.  Discussed a lot in (the latter part of)
    Trac #11224.
    
    This patch fixes the most complex issues:
    
    - Both parser and renamer now treat pattern synonyms as an
      ordinary LHsSigType.  Nothing special.  Hooray.
    
    - tcPatSynSig (now in TcPatSyn) typechecks the signature, and
      decomposes it into its pieces.
      See Note [Pattern synonym signatures]
    
    - tcCheckPatSyn has had a lot of refactoring.
      See Note [Checking against a pattern signature]
    
    The result is a lot tidier and more comprehensible.
    Plus, it actually works!
    
    NB: this patch doesn't actually address the precise
        target of #11224, namely "inlining pattern synonym
        does not preserve semantics".  That's an unrelated
        bug, with a separate patch.
    
    ToDo: better documentation in the user manual
    
    Test Plan: Validate
    
    Reviewers: austin, hvr, goldfire
    
    Subscribers: goldfire, mpickering, thomie, simonpj
    
    Differential Revision: https://phabricator.haskell.org/D1685
    
    GHC Trac Issues: #11224
    f40e122b
TcPatSyn.hs 34.5 KB