[commit: ghc] master: Use a ReaderT in TcDeriv to avoid some tedious plumbing (ed7a830)

git at git.haskell.org git at git.haskell.org
Tue Aug 15 01:35:42 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/ed7a830de6a2ea74dd6bb81f8ec55b9fe0b52f28/ghc

>---------------------------------------------------------------

commit ed7a830de6a2ea74dd6bb81f8ec55b9fe0b52f28
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Mon Aug 14 20:56:04 2017 -0400

    Use a ReaderT in TcDeriv to avoid some tedious plumbing
    
    Addresses point (2) of https://phabricator.haskell.org/D3337#107865.
    
    Before, several functions in `TcDeriv` and `TcDerivInfer` which compute
    an `EarlyDerivSpec` were manually threading through about 10 different
    arguments, which contribute to quite a lot of clutter whenever they need
    to be updated. To minimize this plumbing, and to make it clearer which
    of these 10 values are being used where, I refactored the code in
    `TcDeriv` and `TcDerivInfer` to use a new `DerivM` type:
    
    ```lang=haskell
    type DerivM = ReaderT DerivEnv TcRn
    ```
    
    where `DerivEnv` contains the 10 aforementioned values. In addition to
    cleaning up the code, this should make some subsequent changes planned
    for later less noisy.
    
    Test Plan: ./validate
    
    Reviewers: austin, bgamari
    
    Subscribers: rwbarton, thomie
    
    Differential Revision: https://phabricator.haskell.org/D3846


>---------------------------------------------------------------

ed7a830de6a2ea74dd6bb81f8ec55b9fe0b52f28
 compiler/typecheck/TcDeriv.hs      | 767 +++++++++++++++++++------------------
 compiler/typecheck/TcDerivInfer.hs | 452 ++++++++++++----------
 compiler/typecheck/TcDerivUtils.hs |  60 +++
 3 files changed, 693 insertions(+), 586 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 ed7a830de6a2ea74dd6bb81f8ec55b9fe0b52f28


More information about the ghc-commits mailing list