[commit: ghc] master: Merge types and kinds in DsMeta (b3b564f)
git at git.haskell.org
git at git.haskell.org
Fri Jul 28 15:52:31 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/b3b564fbc0ceb06e6a880289935449fda7d33f31/ghc
>---------------------------------------------------------------
commit b3b564fbc0ceb06e6a880289935449fda7d33f31
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date: Fri Jul 28 11:35:37 2017 -0400
Merge types and kinds in DsMeta
Summary:
Types and kinds are now the same in GHC... well, except in the code
that involves Template Haskell, where types and kinds are given separate
treatment. This aims to unify that treatment in the `DsMeta` module.
The gist of this patch is replacing all uses of `repLKind` with `repLTy`.
This is isn't quite as simple as one might imagine, since `repLTy` returns a
`Core (Q Type)` (a monadic expression), whereas `repLKind` returns a
`Core Kind` (a pure expression). This causes many awkward impedance mismatches.
One option would be to change every combinator in `Language.Haskell.TH.Lib` to
take `KindQ` as an argument instead of `Kind`. But this would be a breaking
change of colossal proportions.
Instead, this patch takes a somewhat different approach. This migrates the
existing `Language.Haskell.TH.Lib` module to
`Language.Haskell.TH.Lib.Internal`, and changes all `Kind`-related combinators
in `Language.Haskell.TH.Lib.Internal` to live in `Q`. The new
`Language.Haskell.TH.Lib` module then re-exports most of
`Language.Haskell.TH.Lib.Internal` with the exception of the `Kind`-related
combinators, for which it redefines them to be their current definitions (which
don't live in `Q`). This allows us to retain backwards compatibility with
previous `template-haskell` releases, but more importantly, it allows GHC to
make as many changes to the `Internal` code as it wants for its purposes
without fear of disrupting the public API.
This solves half of #11785 (the other half being `TcSplice`).
Test Plan: ./validate
Reviewers: goldfire, austin, bgamari
Reviewed By: goldfire
Subscribers: rwbarton, thomie
GHC Trac Issues: #11785
Differential Revision: https://phabricator.haskell.org/D3751
>---------------------------------------------------------------
b3b564fbc0ceb06e6a880289935449fda7d33f31
compiler/deSugar/DsMeta.hs | 183 ++---
compiler/prelude/THNames.hs | 124 ++-
.../template-haskell/Language/Haskell/TH/Lib.hs | 836 ++-------------------
.../Haskell/TH/{Lib.hs => Lib/Internal.hs} | 267 +++----
libraries/template-haskell/changelog.md | 8 +
libraries/template-haskell/template-haskell.cabal | 2 +
testsuite/tests/quotes/TH_localname.stderr | 2 +-
testsuite/tests/th/T13642.hs | 4 +-
testsuite/tests/th/T13642.stderr | 4 -
testsuite/tests/th/T7276.stderr | 4 +-
testsuite/tests/th/all.T | 2 +-
11 files changed, 280 insertions(+), 1156 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc b3b564fbc0ceb06e6a880289935449fda7d33f31
More information about the ghc-commits
mailing list