[Haskell-cafe] Inlinable (>>>)

David Sorokin david.sorokin at gmail.com
Thu Mar 2 15:18:32 UTC 2017


Hi Cafe,

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 suppose that the current definition without the pragma is the cause why the execution slows down in my applications, when using monad parameters in the constraints. I noticed it yet two or three years ago, while playing with the monad transformers, but decided to write now.

Best regards,
David Sorokin






More information about the Haskell-Cafe mailing list