[Haskell-cafe] Class-like features for explicit arguments

Carter Schonwald carter.schonwald at gmail.com
Sat Apr 25 22:17:44 UTC 2015


Ok cool. Sounds like we agree.
Luite and I talked about something similar a few months ago, I'll try to
dig up my notes and maybe we can turn this into a ghc feature request or
patch

On Saturday, April 25, 2015, Ertugrul Söylemez <ertesx at gmx.de> wrote:

> > are you sure you've evaluated how it interacts with this sort of
> > optimization? I think it actually gets you pretty far!
>
> Most of the magic occurs in reification.  The trouble is that it expects
> a polymorphic function of rank 2 with a nontrivial context (Reifies), a
> function that by construction cannot be specialised, unless you
> specialise the receiving function (reify) for every application case.
> The beauty of reflection is that it's free by virtue of sharing.
> Unfortunately sharing is the exact opposite of inlining.
>
> According to a benchmark I've done a few months ago it behaves exactly
> as if the reflected value was just a shared argument with no inlining
> performed; an expected and reasonable result.
>
> What I'm really after is a sort of controlled inlining.  That's pretty
> much what instance-based specialisation currently does for dictionaries.
> Technically a dictionary is just another argument, so there is no
> fundamental reason why we shouldn't have a more general specialiser.
>
>
> >> > Here yah go https://hackage.haskell.org/package/reflection
> >> > It exploits how dictionary passing works in a pretty robust way that
> >> > ghc is likely to at some point codify officially.
> >>
> >> Oh, that one.  Of course I'm familiar with it, but it's less an
> >> optimisation than a clever way to implement implicit configurations.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150425/675d1f64/attachment.html>


More information about the Haskell-Cafe mailing list