Constructor wrappers vs workers in generated Core

Christopher Done chrisdone at gmail.com
Sat Feb 2 15:07:07 UTC 2019


On Sat, 2 Feb 2019 at 14:50, Matthew Pickering
<matthewtpickering at gmail.com> wrote:
> There is no way to turn off wrappers and I don't think it would be
> possible to implement easily if at all.

Fair enough.

> However, they will all probably be inlined after the optimiser runs
> but it seems that you don't want to run the optimiser at all on the
> generated core?

Yeah, I'm trying to avoid as much instability in the output shape as
possible, and for educational purposes, optimizations make fairly
readable code unreadable.

Wait. Can I rely on case alt patterns having the same arity as the
original user-defined data type before optimization passes are run?

If the answer to that is yes, then I could just replace all wrapper
calls with worker calls, which is an easy enough transformation. As a
precaution, I could add a check on all case alt patterns that the
arity matches the worker arity and barf if not.

Thanks for your help!

Chris


More information about the ghc-devs mailing list