[Git][ghc/ghc][wip/instd-quantifications] TH: handle explicit quantification in instances

sheaf (@sheaf) gitlab at gitlab.haskell.org
Mon Jan 30 14:35:56 UTC 2023



sheaf pushed to branch wip/instd-quantifications at Glasgow Haskell Compiler / GHC


Commits:
f2e30b9e by sheaf at 2023-01-30T15:35:57+01:00
TH: handle explicit quantification in instances

This patch adds support for explicitly-written quantification in
typeclass instances, such as:

  instance forall {k} (a :: k). C a
  deriving instance forall {k} (a :: k). D a

It does so by adding a field of type `Maybe (TyVarBndr Specificity)`
to both the `InstanceD` and `StandaloneDerivD` constructors of the
Template Haskell `Dec` datatype, and making appropriate use of it to
ensure that spliced declarations don't silently drop the user-written
quantification.

Fixes #21794

- - - - -


30 changed files:

- compiler/GHC/Builtin/Names/TH.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Tc/Gen/Splice.hs
- compiler/GHC/ThToHs.hs
- compiler/GHC/Types/Var.hs
- docs/users_guide/9.8.1-notes.rst
- libraries/template-haskell/Language/Haskell/TH/Lib.hs
- libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
- libraries/template-haskell/Language/Haskell/TH/Ppr.hs
- libraries/template-haskell/Language/Haskell/TH/Syntax.hs
- libraries/template-haskell/changelog.md
- testsuite/tests/ghci/scripts/T4127.stdout
- testsuite/tests/safeHaskell/safeLanguage/SafeLang11_B.hs
- testsuite/tests/safeHaskell/safeLanguage/SafeLang12_B.hs
- testsuite/tests/th/T11629.hs
- testsuite/tests/th/T14888.stderr
- testsuite/tests/th/T1835.stdout
- + testsuite/tests/th/T21794.hs
- + testsuite/tests/th/T21794.stderr
- testsuite/tests/th/T5452.hs
- testsuite/tests/th/T5700a.hs
- testsuite/tests/th/T5886a.hs
- testsuite/tests/th/T7532a.hs
- testsuite/tests/th/T8100.hs
- testsuite/tests/th/T8625.stdout
- testsuite/tests/th/T8953.stderr
- testsuite/tests/th/T9262.stderr
- testsuite/tests/th/TH_reifyExplicitForAllFams.stderr


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f2e30b9ee8923add413d4de08d043e2da852b4c9

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f2e30b9ee8923add413d4de08d043e2da852b4c9
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230130/23b5dd2e/attachment.html>


More information about the ghc-commits mailing list