Hi Richard,

Thanks for looking into this!

On Mon, 9 Sep 2013, Richard Eisenberg wrote:

I took a look here and would like to help, but I'm confused: What makes you think the dictionary for (Eq [b]) would be in scope? I can see where the (Eq b) comes from (the theta that pops out of patSynSig), but where does (Eq [b]) come from?

pattern P b b' = (MkT b b', ())

f (P x y) = [x] == [y]

I thought when I call 'thing_inside' in tcPatSynPat, it would (eventually) get to typechecking the right-hand side, which has a dependency on (Eq [b]). I thought this dependency is captured somewhere around here so that it(s solution) can be added to the pat_binds field of the ConPatOut. Otherwise, I don't see where it should be created -- and as you can see from the warning emitted by GHC, it is assumed later on to be there:

WARNING: file compiler/coreSyn/CoreSubst.lhs, line 272
    CoreSubst.lookupIdSubst simpleOptExpr $dEq_an7{v} [lid]
    InScope [(00, wild_00{v} [lid]), (X6, wild_X6{v} [lid]),
             (Xb, wild_Xb{v} [lid]), (amr, x{v amr} [lid]),
             (ams, y{v ams} [lid]), (amR, b{tv amR} [tv]),
             (an5, $dEq_an5{v} [lid]), (an8, cobox_an8{v} [lid]),
             (dnk, ds_dnk{v} [lid]), (dnl, ds_dnl{v} [lid]),
             (dnm, ds_dnm{v} [lid]), (dnr, cobox{v dnr} [lid]),
             (rgK, main:ConstrEx.f{v rgK} [lidx])]

here, $dEq_an5 is (Eq b), and $dEq_an7 is (Eq [b]).

So it seems the emitted core expects this (Eq [b]) to be there (bound to the parametrised instance (Eq[] (Eq b))).

Thanks,
        Gergo
_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://www.haskell.org/mailman/listinfo/ghc-devs

Reply via email to