[commit: ghc] master: Rejig builders for pattern synonyms, especially unlifted ones (e876208)

git at git.haskell.org git at git.haskell.org
Fri Nov 21 13:02:57 UTC 2014


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

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

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

commit e876208117a34fb58f7f1e470de2f954b3ca303d
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Nov 21 10:04:09 2014 +0000

    Rejig builders for pattern synonyms, especially unlifted ones
    
    When a pattern synonym is for an unlifted pattern, its "builder" would
    naturally be a top-level unlifted binding, which isn't allowed.  So we
    give it an extra Void# argument.
    
    Our Plan A involved then making *two* Ids for these builders, with
    some consequential fuss in the desugarer.  This was more pain than I
    liked, so I've re-jigged it.
    
     * There is just one builder for a pattern synonym.
    
     * It may have an extra Void# arg, but this decision is signalled
       by the Bool in the psBuilder field.
    
       I did the same for the psMatcher field.
    
       Both Bools are serialised into interface files, so there is
       absolutely no doubt whether that extra Void# argument is required.
    
     * I renamed "wrapper" to "builder".  We have too may "wrappers"
    
     * In order to deal with typecchecking occurrences of P in expressions,
       I refactored the tcInferId code in TcExpr.
    
    All of this allowed me to revert 5fe872
       "Apply compulsory unfoldings during desugaring, except for `seq` which is special."
    which turned out to be a rather messy hack in DsBinds


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

e876208117a34fb58f7f1e470de2f954b3ca303d
 compiler/basicTypes/PatSyn.lhs       | 207 +++++++++++++++---------------
 compiler/deSugar/DsExpr.lhs          |  22 +---
 compiler/deSugar/DsUtils.lhs         |  10 +-
 compiler/iface/BuildTyCl.lhs         |   8 +-
 compiler/iface/IfaceSyn.lhs          |  12 +-
 compiler/iface/MkIface.lhs           |   9 +-
 compiler/iface/TcIface.lhs           |  65 ++--------
 compiler/typecheck/TcBinds.lhs       |  14 +--
 compiler/typecheck/TcExpr.lhs        | 162 ++++++++----------------
 compiler/typecheck/TcPatSyn.lhs      | 237 +++++++++++++++++++++--------------
 compiler/typecheck/TcPatSyn.lhs-boot |   4 +-
 compiler/typecheck/TcRnMonad.lhs     |   5 +
 12 files changed, 338 insertions(+), 417 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 e876208117a34fb58f7f1e470de2f954b3ca303d


More information about the ghc-commits mailing list