[Haskell-cafe] inference with implicitparams seems broken
rowan goemans
goemansrowan at gmail.com
Thu Mar 24 21:37:30 UTC 2022
Hi Richard,
Thanks for answering. I have made a tiny change to GHC in a fork that
lifts the monomorphization restriction but only for implicit params. See
this commit:
https://gitlab.haskell.org/rowanG/ghc/-/merge_requests/1/diffs?commit_id=35fcad2d7f556706dd129a57815abe421a559861
Is there some example I could run to see in action why the
monomorphisation restriction is required? I looked at the Haskell report
and I don't immediately see why the points raised apply to implicit
params. I get a feeling that monomorph(Contains only a concrete type
like Int or Bool) implicit params would never be a problem and maybe
only polymorphic ones are?
Rowan Goemans
On 3/24/22 20:05, Richard Eisenberg wrote:
>
>
>> On Mar 24, 2022, at 9:04 AM, rowan goemans <goemansrowan at gmail.com>
>> wrote:
>>
>> is this by design/expected though?
>
> It is by design, yes. With a sufficiently nuanced expectation, I would
> also say it's expected. (Though, to be fair, if I were not primed to
> be thinking about the monomorphism restriction, I can't honestly say I
> would get it right if quizzed.)
>
>> Would there be interest in fixing this in GHC?
>
> Figuring out when to generalize a local binding is a hard problem. So,
> there is definitely interest in finding a better way to do it, but I
> don't think anyone knows a design that meets the most expectations.
> Language design is hard! :)
>
> Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20220324/0b57bd5e/attachment.html>
More information about the Haskell-Cafe
mailing list