[commit: ghc] master: Use NonEmpty lists to represent lists of duplicate elements (7d69978)

git at git.haskell.org git at git.haskell.org
Sat Aug 12 20:18:29 UTC 2017


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

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

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

commit 7d699782bf6148c115a49b5f31ada9bd7c32a7d6
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Sat Aug 12 15:47:27 2017 -0400

    Use NonEmpty lists to represent lists of duplicate elements
    
    Summary:
    Three functions in `ListSetOps` which compute duplicate elements
    represent lists of duplicates of `[a]`. This is a really bad way to go about
    things, because these lists are guaranteed to always have at least one element
    (the "representative" of the duplicates), and several places in the GHC API
    call `head` (a partial function) on these lists of duplicates to retrieve the
    representative.
    
    This changes the representation of duplicates to `NonEmpty` lists instead,
    which allow for many partial uses of `head` to be made total.
    
    Fixes #13823.
    
    Test Plan: ./validate
    
    Reviewers: bgamari, austin, goldfire
    
    Reviewed By: bgamari
    
    Subscribers: goldfire, rwbarton, thomie
    
    GHC Trac Issues: #13823
    
    Differential Revision: https://phabricator.haskell.org/D3823


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

7d699782bf6148c115a49b5f31ada9bd7c32a7d6
 compiler/coreSyn/CoreLint.hs       | 10 ++++++----
 compiler/rename/RnBinds.hs         | 17 ++++++++++-------
 compiler/rename/RnExpr.hs          |  3 ++-
 compiler/rename/RnPat.hs           |  9 +++++----
 compiler/rename/RnSource.hs        | 21 +++++++++++----------
 compiler/rename/RnTypes.hs         |  7 ++++---
 compiler/rename/RnUtils.hs         |  7 ++++---
 compiler/typecheck/TcBinds.hs      |  3 ++-
 compiler/typecheck/TcErrors.hs     |  3 ++-
 compiler/typecheck/TcSimplify.hs   | 13 ++++++++-----
 compiler/typecheck/TcTyClsDecls.hs |  4 ++--
 compiler/typecheck/TcValidity.hs   |  5 +++--
 compiler/utils/ListSetOps.hs       | 26 ++++++++++++++------------
 13 files changed, 73 insertions(+), 55 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 7d699782bf6148c115a49b5f31ada9bd7c32a7d6


More information about the ghc-commits mailing list