Specializing functions with implicit parameters

Sandy Maguire sandy at sandymaguire.me
Sun Mar 15 01:03:52 UTC 2020


What GHC are you testing against? I suspect
https://gitlab.haskell.org/ghc/ghc/merge_requests/668 will fix this.

On Sat, Mar 14, 2020 at 4:20 PM Alexis King <lexi.lambda at gmail.com> wrote:

> Hi all,
>
> I discovered today that GHC never specializes functions with implicit
> parameters. This is not that surprising—I wouldn’t expect GHC to specialize
> the implicit parameters themselves—but it’s unfortunate because it means a
> single implicit parameter somewhere can transitively destroy specialization
> that would otherwise be very helpful.
>
> Is there any obstacle to specializing these functions’ other dictionaries
> and leaving the implicit parameters alone? That is, if I have a function
>
>     foo :: (?foo :: Bool, Show a) => a -> String
>
> could GHC specialize `foo @Int` to
>
>     foo :: (?foo :: Bool) => Int -> String
>
> treating the implicit parameter little differently from an ordinary
> function argument?
>
> As far as I can tell, there isn’t any real obstacle to doing this, so
> unless I’m missing something, I might give it a try myself. I just wanted
> to make sure I wasn’t missing anything before diving in.
>
> Thanks,
> Alexis
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20200314/c0735f79/attachment.html>


More information about the ghc-devs mailing list