Help understanding Specialise.lhs
Simon Peyton Jones
simonpj at microsoft.com
Mon Oct 20 16:11:49 UTC 2014
David
If you want to suggest a couple of possible alternative 20-min slots in work time (London time zone), not Mon-Weds this week, then maybe we can find a mutually convenient time.
Do you have reason to suppose that the pattern you describe below is common? That is, if implemented, would it make a big difference to programs we care about?
Simon
From: David Feuer [mailto:david.feuer at gmail.com]
Sent: 20 October 2014 13:58
To: Simon Peyton Jones
Cc: ghc-devs
Subject: Re: Help understanding Specialise.lhs
To be super-clear about at least one aspect: I don't want Tidy Core to ever contain something that looks like this:
GADTTest.potato
:: GHC.Types.Int<http://GHC.Types.Int> -> GADTTest.Silly GHC.Types.Int<http://GHC.Types.Int> -> GHC.Types.Int<http://GHC.Types.Int>
GADTTest.potato =
\ (x_asZ :: GHC.Types.Int<http://GHC.Types.Int>)
(ds_dPR :: GADTTest.Silly GHC.Types.Int<http://GHC.Types.Int>) ->
case ds_dPR of _ { GADTTest.Silly $dNum_aLV ds1_dPS ->
GHC.Num.+ @ GHC.Types.Int<http://GHC.Types.Int> $dNum_aLV x_asZ x_asZ
}
Here we see GHC.Num.+ applied to GHC.Types.Int<http://GHC.Types.Int> and $dNum_aLV. We therefore know that $dNum_aLV must be GHC.Num.$fNumInt, so GHC.Num.+ can eat these arguments and produce GHC.Num.$fNumInt_$c+. But for some reason, GHC fails to recognize and exploit this fact! I would like help understanding why that is, and what I can do to fix it.
On Mon, Oct 20, 2014 at 7:53 AM, David Feuer <david.feuer at gmail.com<mailto:david.feuer at gmail.com>> wrote:
On Oct 20, 2014 5:05 AM, "Simon Peyton Jones" <simonpj at microsoft.com<mailto:simonpj at microsoft.com>> wrote:
> I’m unclear what you are trying to achieve with #9701. I urge you to write a clear specification that we all agree about before burning cycles hacking code.
What I'm trying to achieve is to make specialization work in a situation where it currently does not. It appears that when the type checker determines that a GADT carries a certain dictionary, the specializer happily uses it *even once the concrete type is completely known*. What we would want to do in that case is to replace the use of the GADT-carried dictionary with a use of the known dictionary for that type.
> There are a lot of comments at the top of Specialise.lhs. But it is, I’m afraid, a tricky pass. I could skype.
I would appreciate that. What day/time are you available?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20141020/ac2fef57/attachment-0001.html>
More information about the ghc-devs
mailing list