[GHC] #9781: Make list monad operations fuse

David Feuer david.feuer at gmail.com
Tue Nov 11 09:12:14 UTC 2014


On Nov 11, 2014 3:56 AM, "Kim-Ee Yeoh" <ky3 at atamo.com> wrote:
>
> From the patch fragment at
>
> https://phabricator.haskell.org/D455?id=1311#inline-3123
>
> What's the justification for expanding out the definition of mapM from
"sequence . map f" into do-notation and duplicated code?
>
> Observe how mapM now duplicates code from sequence.

One good option might be to redefine sequence in terms of mapM.

> The absence of benchmarks is bad enough. What's worse is that the given
excuse boils down to "Pity the poor compiler! Let's take over its work
instead. Like, just in case, you know."

The excuse is that it actually makes a big difference for nofib. Why? I
would have to guess it relates to what inlines when. The inliner is a
finicky beast. In response to your insults, I will say that although GHC
has beautiful ideas in it, a lot of the details of the optimization passes
and how they fit together *are* a bit of a crapshoot, chosen by benchmarks
rather than theory. Theory sometimes comes up behind and explains why the
benchmarks do what they do, but you can't expect every little change to be
backed up by some deep theoretical reason.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20141111/bdf03ec9/attachment.html>


More information about the Libraries mailing list