Skip to content
  • Vladislav Zavialov's avatar
    Parse the (!) type operator and allow type operators in existential context · bd789853
    Vladislav Zavialov authored and Ryan Scott's avatar Ryan Scott committed
    Summary:
    Improve the way `(!)`, `(~)`, and other type operators are handled in the parser,
    fixing two issues at once:
    
    1. `(!)` can now be used as a type operator
       that respects fixity and precedence (#15457)
    2. Existential context of a data constructor
       no longer needs parentheses (#15675)
    
    In addition to that, with this patch it is now trivial to adjust precedence of
    the `{-# UNPACK #-}` pragma, as suggested in
    https://ghc.haskell.org/trac/ghc/ticket/14761#comment:7
    
    There was a small change to API Annotations. Before this patch, `(~)` was a
    strange special case that produced an annotation unlike any other type
    operator. After this patch, when `(~)` or `(!)` are used to specify strictness they
    produce AnnTilde and AnnBang annotations respectively, and when they are used
    as type operators, they produce no annotations.
    
    Test Plan: Validate
    
    Reviewers: simonpj, bgamari, alanz, RyanGlScott
    
    Reviewed By: RyanGlScott
    
    Subscribers: RyanGlScott, rwbarton, mpickering, carter
    
    GHC Trac Issues: #15457, #15675
    
    Differential Revision: https://phabricator.haskell.org/D5180
    bd789853