Visible forall in types of terms: Part 1 (#22326)
This patch implements part 1 of GHC Proposal #281, introducing explicit `type` patterns and `type` arguments. Summary of the changes: 1. New extension flag: RequiredTypeArguments 2. New user-facing syntax: `type p` patterns (represented by EmbTyPat) `type e` expressions (represented by HsEmbTy) 3. Functions with required type arguments (visible forall) can now be defined and applied: idv :: forall a -> a -> a -- signature (relevant change: checkVdqOK in GHC/Tc/Validity.hs) idv (type a) (x :: a) = x -- definition (relevant change: tcPats in GHC/Tc/Gen/Pat.hs) x = idv (type Int) 42 -- usage (relevant change: tcInstFun in GHC/Tc/Gen/App.hs) 4. template-haskell support: TH.TypeE corresponds to HsEmbTy TH.TypeP corresponds to EmbTyPat 5. Test cases and a new User's Guide section Changes *not* included here are the t2t (term-to-type) transformation and term variable capture; those belong to part 2.
Showing
- compiler/GHC/Builtin/Names/TH.hs 20 additions, 14 deletionscompiler/GHC/Builtin/Names/TH.hs
- compiler/GHC/Core/DataCon.hs 4 additions, 6 deletionscompiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/TyCon.hs 5 additions, 4 deletionscompiler/GHC/Core/TyCon.hs
- compiler/GHC/Driver/Session.hs 1 addition, 0 deletionscompiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/Expr.hs 10 additions, 0 deletionscompiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Pat.hs 11 additions, 0 deletionscompiler/GHC/Hs/Pat.hs
- compiler/GHC/Hs/Syn/Type.hs 2 additions, 0 deletionscompiler/GHC/Hs/Syn/Type.hs
- compiler/GHC/Hs/Utils.hs 7 additions, 3 deletionscompiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Expr.hs 2 additions, 0 deletionscompiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Match.hs 1 addition, 0 deletionscompiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Pmc/Desugar.hs 1 addition, 0 deletionscompiler/GHC/HsToCore/Pmc/Desugar.hs
- compiler/GHC/HsToCore/Quote.hs 8 additions, 0 deletionscompiler/GHC/HsToCore/Quote.hs
- compiler/GHC/HsToCore/Ticks.hs 1 addition, 0 deletionscompiler/GHC/HsToCore/Ticks.hs
- compiler/GHC/Iface/Ext/Ast.hs 6 additions, 0 deletionscompiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Parser.y 5 additions, 0 deletionscompiler/GHC/Parser.y
- compiler/GHC/Parser/PostProcess.hs 17 additions, 3 deletionscompiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Rename/Bind.hs 4 additions, 0 deletionscompiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/Expr.hs 9 additions, 0 deletionscompiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/Pat.hs 4 additions, 0 deletionscompiler/GHC/Rename/Pat.hs
- compiler/GHC/Tc/Errors/Ppr.hs 40 additions, 5 deletionscompiler/GHC/Tc/Errors/Ppr.hs
Loading
Please register or sign in to comment