[Haskell-cafe] Inlinable (>>>)

Joachim Breitner mail at joachim-breitner.de
Fri Mar 3 11:40:35 UTC 2017


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 at joachim-breitner.dehttps://www.joachim-breitner.de/
  XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F
  Debian Developer: nomeata at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170303/2edaf8b6/attachment.sig>


More information about the Haskell-Cafe mailing list