[commit: ghc] wip/pattern-synonym-backport: Rejig builders for pattern synonyms, especially unlifted ones (0f1f3e1)

git at git.haskell.org git at git.haskell.org
Sat Dec 20 08:46:56 UTC 2014


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

On branch  : wip/pattern-synonym-backport
Link       : http://ghc.haskell.org/trac/ghc/changeset/0f1f3e1db73fc528ebd53938e2c39af62263c739/ghc

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

commit 0f1f3e1db73fc528ebd53938e2c39af62263c739
Author: Dr. ERDI Gergo <gergo at erdi.hu>
Date:   Sat Dec 20 16:44:20 2014 +0800

    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
    
        (cherry picked from commit e876208117a34fb58f7f1e470de2f954b3ca303d)


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

0f1f3e1db73fc528ebd53938e2c39af62263c739
 compiler/basicTypes/PatSyn.lhs   | 171 +++++++++++++++----------
 compiler/deSugar/DsUtils.lhs     |  10 +-
 compiler/iface/BuildTyCl.lhs     |   8 +-
 compiler/iface/IfaceSyn.lhs      |  14 +--
 compiler/iface/MkIface.lhs       |   9 +-
 compiler/iface/TcIface.lhs       |  17 ++-
 compiler/typecheck/TcBinds.lhs   |   4 -
 compiler/typecheck/TcExpr.lhs    |  27 ++--
 compiler/typecheck/TcPatSyn.lhs  | 264 +++++++++++++++++++++++++--------------
 compiler/typecheck/TcRnMonad.lhs |   5 +
 10 files changed, 316 insertions(+), 213 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 0f1f3e1db73fc528ebd53938e2c39af62263c739


More information about the ghc-commits mailing list