I had a similar WTF moment when I noticed that Lucid's HtmlT over IO was 2x slower than HtmlT over Reader/Identity. Discussions over this mailing list pointed to the lack of INLINE pragmas on various functions, like >>=

It was finally resolved via a liberal sprinkling of INLINE -- https://github.com/chrisdone/lucid/pull/67/files 

Why can't GHC automatically consider *every* function as INLINABLE? Let the GHC heuristics decide what is worthy of being inlined. What's the downside?

-- Saurabh. 

On 3 Mar 2017 5:36 pm, "Matthew Pickering" <matthewtpickering@gmail.com> wrote:
I suspect this is because GHC will not specialise functions when used
in other modules unless they are marked INLINABLE.

Matt

On Fri, Mar 3, 2017 at 11:40 AM, Joachim Breitner
<mail@joachim-breitner.de> wrote:
> Hi,
>
> Am Donnerstag, den 02.03.2017, 18:18 +0300 schrieb David Sorokin:
>> I offer to define the functions of the Control.Category module
>> inlinable:
>>
>> -- | Right-to-left composition
>> (<<<) :: Category cat => cat b c -> cat a b -> cat a c
>> {-# INLINABLE (<<<) #-}
>> (<<<) = (.)
>>
>> -- | Left-to-right composition
>> (>>>) :: Category cat => cat a b -> cat b c -> cat a c
>> {-# INLINABLE (>>>) #-}
>> f >>> g = g . f
>>
>> Perhaps all functions from this module should be marked by this
>> pragma as possible.
>
> I am surprised that GHC does not consider these inlineable
> automatically. Maybe it should? Would be worth investigating, if
> someone is interested in some entry-level GHC hacking, why GHC does not
> treat them as `INLINEABLE` in the first place. They are certainly small
> enough, I would say…
>
> Joachim
>
> --
> Joachim “nomeata” Breitner
>   mail@joachim-breitner.dehttps://www.joachim-breitner.de/
>   XMPP: nomeata@joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F
>   Debian Developer: nomeata@debian.org
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.