diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2016-10-06 09:14:49 -0400 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2016-10-06 09:14:49 -0400 |
commit | 4a03012aeb4cb6685221b30aea2b1a78145d902b (patch) | |
tree | 43c9c13c18d31fa5b421211155355011b0d1403f /compiler/ghc.cabal.in | |
parent | 58ecdf83ff8790b49bdfcba628d189229f81d2a0 (diff) | |
download | haskell-4a03012aeb4cb6685221b30aea2b1a78145d902b.tar.gz |
Refactor TcDeriv and TcGenDeriv
Summary:
Keeping a promise I made to Simon to clean up these modules.
This change splits up the massive `TcDeriv` and `TcGenDeriv` modules into
somewhat more manageable pieces. The new modules are:
* `TcGenFunctor`: This contains the deriving machinery for `Functor`,
`Foldable`, and `Traversable` (which all use the same underlying algorithm).
* `TcDerivInfer`: This is the new home for `inferConstraints`,
`simplifyInstanceContexts`, and related functions, whose role is to come up
with the derived instance context and subsequently simplify it.
* `TcDerivUtils`: This is a grab-bag module that contains several
error-checking utilities originally in `TcDeriv`, as well as some functions
that `TcDeriv` and `TcDerivInfer` both need.
The end result is that `TcDeriv` is now less than 1,600 SLOC (originally 2,686
SLOC), and `TcGenDeriv` is now about 2,000 SLOC (originally 2,964).
In addition, this also implements a couple of tiny refactorings:
* I transformed `type Condition = (DynFlags, TyCon) -> Validity` into
`type Condition = DynFlags -> TyCon -> Validity`
* I killed the `DerivSpecGeneric` constructor for `DerivSpecMechanism`, and
merged its functionality into `DerivSpecStock`. In addition,
`hasStockDeriving` now contains key-value pairs for `Generic` and `Generic1`,
so they're no longer treated as an awkward special case in `TcDeriv`.
Test Plan: ./validate
Reviewers: simonpj, austin, bgamari
Reviewed By: simonpj
Subscribers: thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D2568
Diffstat (limited to 'compiler/ghc.cabal.in')
-rw-r--r-- | compiler/ghc.cabal.in | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 3d75dae0c1..ab72b455cf 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -405,10 +405,13 @@ Library TcClassDcl TcDefaults TcDeriv + TcDerivInfer + TcDerivUtils TcEnv TcExpr TcForeign TcGenDeriv + TcGenFunctor TcGenGenerics TcHsSyn TcHsType |