[Haskell-cafe] Monad transformer performance - Request to review benchmarking code + results

Saurabh Nanda saurabhnanda at gmail.com
Mon Jan 30 17:25:41 UTC 2017

Was going through
and came across the SPECIALIZE pragma. Is it possible to write it in a way
that it specializes a complete monad transformer stack to given concrete

-- Saurabh.

On 30 Jan 2017 10:27 am, "Saurabh Nanda" <saurabhnanda at gmail.com> wrote:

> Why do you keep expecting the compiler to "be smart"? It's just shuffling
>> data around, any type of magic efficiency with Monadic computations
>> requires specific knowledge about monads, which is not something we encode
>> into the compiler. just saying "this should be obvious" is not very
>> productive.
> Two reasons:
> * If inlining certain functions can give a boost to the performance, then
> is it unreasonable to expect the compiler to have better heuristics about
> when commonly occurring code patterns should be inlined? In this case
> monads and mtl being the commonly occurring code patterns.
> * At a broader level, the promise of writing pure functions was to be able
> to talk about 'intent', not 'implementation' -- the classic `map` vs `for
> loop` example. Additionally, pure functions give the compiler enough
> opportunity to optimise code. Both these higher level promises are being
> broken by this experience. Hence, I'm feeling "cheated"
> -- Saurabh.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170130/d543dc7a/attachment.html>

More information about the Haskell-Cafe mailing list