Help understanding Specialise.lhs
David Feuer
david.feuer at gmail.com
Mon Oct 20 12:57:47 UTC 2014
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 -> GADTTest.Silly GHC.Types.Int -> GHC.Types.Int
GADTTest.potato =
\ (x_asZ :: GHC.Types.Int)
(ds_dPR :: GADTTest.Silly GHC.Types.Int) ->
case ds_dPR of _ { GADTTest.Silly $dNum_aLV ds1_dPS ->
GHC.Num.+ @ GHC.Types.Int $dNum_aLV x_asZ x_asZ
}
Here we see GHC.Num.+ applied to 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> wrote:
> On Oct 20, 2014 5:05 AM, "Simon Peyton Jones" <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/967141b2/attachment.html>
More information about the ghc-devs
mailing list