Skip to content
Snippets Groups Projects
Forked from Glasgow Haskell Compiler / GHC
Source project has a limited visibility.
  • Vladislav Zavialov's avatar
    4aea0a72
    Invisible binders in type declarations (#22560) · 4aea0a72
    Vladislav Zavialov authored
    
    This patch implements @k-binders introduced in GHC Proposal #425
    and guarded behind the TypeAbstractions extension:
    
    	type D :: forall k j. k -> j -> Type
    	data D @k @j a b = ...
    	       ^^ ^^
    
    To represent the new syntax, we modify LHsQTyVars as follows:
    
    	-  hsq_explicit :: [LHsTyVarBndr () pass]
    	+  hsq_explicit :: [LHsTyVarBndr (HsBndrVis pass) pass]
    
    HsBndrVis is a new data type that records the distinction between
    type variable binders written with and without the @ sign:
    
    	data HsBndrVis pass
    	  = HsBndrRequired
    	  | HsBndrInvisible (LHsToken "@" pass)
    
    The rest of the patch updates GHC, template-haskell, and haddock
    to handle the new syntax.
    
    Parser:
      The PsErrUnexpectedTypeAppInDecl error message is removed.
      The syntax it used to reject is now permitted.
    
    Renamer:
      The @ sign does not affect the scope of a binder, so the changes to
      the renamer are minimal.  See rnLHsTyVarBndrVisFlag.
    
    Type checker:
      There are three code paths that were updated to deal with the newly
      introduced invisible type variable binders:
    
        1. checking SAKS: see kcCheckDeclHeader_sig, matchUpSigWithDecl
        2. checking CUSK: see kcCheckDeclHeader_cusk
        3. inference: see kcInferDeclHeader, rejectInvisibleBinders
    
      Helper functions bindExplicitTKBndrs_Q_Skol and bindExplicitTKBndrs_Q_Tv
      are generalized to work with HsBndrVis.
    
    Updates the haddock submodule.
    
    Metric Increase:
        MultiLayerModulesTH_OneShot
    
    Co-authored-by: default avatarSimon Peyton Jones <simon.peytonjones@gmail.com>
    4aea0a72
    History
    Invisible binders in type declarations (#22560)
    Vladislav Zavialov authored
    
    This patch implements @k-binders introduced in GHC Proposal #425
    and guarded behind the TypeAbstractions extension:
    
    	type D :: forall k j. k -> j -> Type
    	data D @k @j a b = ...
    	       ^^ ^^
    
    To represent the new syntax, we modify LHsQTyVars as follows:
    
    	-  hsq_explicit :: [LHsTyVarBndr () pass]
    	+  hsq_explicit :: [LHsTyVarBndr (HsBndrVis pass) pass]
    
    HsBndrVis is a new data type that records the distinction between
    type variable binders written with and without the @ sign:
    
    	data HsBndrVis pass
    	  = HsBndrRequired
    	  | HsBndrInvisible (LHsToken "@" pass)
    
    The rest of the patch updates GHC, template-haskell, and haddock
    to handle the new syntax.
    
    Parser:
      The PsErrUnexpectedTypeAppInDecl error message is removed.
      The syntax it used to reject is now permitted.
    
    Renamer:
      The @ sign does not affect the scope of a binder, so the changes to
      the renamer are minimal.  See rnLHsTyVarBndrVisFlag.
    
    Type checker:
      There are three code paths that were updated to deal with the newly
      introduced invisible type variable binders:
    
        1. checking SAKS: see kcCheckDeclHeader_sig, matchUpSigWithDecl
        2. checking CUSK: see kcCheckDeclHeader_cusk
        3. inference: see kcInferDeclHeader, rejectInvisibleBinders
    
      Helper functions bindExplicitTKBndrs_Q_Skol and bindExplicitTKBndrs_Q_Tv
      are generalized to work with HsBndrVis.
    
    Updates the haddock submodule.
    
    Metric Increase:
        MultiLayerModulesTH_OneShot
    
    Co-authored-by: default avatarSimon Peyton Jones <simon.peytonjones@gmail.com>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.