Specializing functions with implicit parameters
Alexis King
lexi.lambda at gmail.com
Sat Mar 14 23:20:21 UTC 2020
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
More information about the ghc-devs
mailing list