[commit: ghc] imp-param-class: Switch back to the simpler `IP` class, no extra newtypes. (867aa8a)

Iavor Diatchki diatchki at galois.com
Wed May 30 04:45:15 CEST 2012


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : imp-param-class

http://hackage.haskell.org/trac/ghc/changeset/867aa8a3cd5710d798b5dbfda7b87bec2d7ca6a3

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

commit 867aa8a3cd5710d798b5dbfda7b87bec2d7ca6a3
Author: Iavor S. Diatchki <diatchki at galois.com>
Date:   Tue May 29 19:45:14 2012 -0700

    Switch back to the simpler `IP` class, no extra newtypes.
    
    XXX: This reveals a bug that for some reason was not showing up before.
    The issue has to do with shadowing of implicit parameters.  For example,
    consider the following definition:
    
    f :: (?x :: Int) => Int
    f = let ?x = (5 :: Int) in ?x
    
    By the time we check the body of the let (i.e., the ?x) we have two pieces of
    evidence for "?x :: Int": one that is a parameter to the function,
    and one from the local definition.  Presumably, the intention here is
    that the local definition should "shadow" the external one, but we
    need some code to do this.  Note that this is not a problem for ordinary
    classes because even we have multiple dictionaries for the same
    constraint are guaranteed to be the same.
    
    My current plan is to try to solve this by adding a special case
    in the handling of nested implication constraints, where implicit
    parameters in the inner implication should shadow (i.e, replace) the
    outer implications (temporarily, for the duration of the implication).
    
    I believe that in the previous implementation of
    implicit parameters this was handled automatically, because we had
    a separate map for the evidence for the implicit parameters.

 compiler/hsSyn/HsExpr.lhs      |    2 +-
 compiler/parser/Parser.y.pp    |    2 +-
 compiler/prelude/PrelNames.lhs |   23 ++---------------------
 compiler/typecheck/TcBinds.lhs |   20 ++++++--------------
 compiler/typecheck/TcExpr.lhs  |   31 ++++++++++++++++---------------
 5 files changed, 26 insertions(+), 52 deletions(-)


Diff suppressed because of size. To see it, use:

    git show 867aa8a3cd5710d798b5dbfda7b87bec2d7ca6a3



More information about the Cvs-ghc mailing list