2 ms·
Spoken like a Haskell programmer, who might write: (wc Lines) . sort . (grep "bar") . (xargs "foo") =<< file But note in this case that all the data "flows
by jrockway 17y ago
Spoken like a Haskell programmer, who might write:
(wc Lines) . sort . (grep "bar") . (xargs "foo") =<< file
But note in this case that all the data "flows in the same direction".
- blasdel 17y agohas been a Haskell programmer since 2005, before the dawn of dons wc Lines $ sort $ grep "bar" $ xargs "foo" =<< file
- jrockway 17y agoThat does not parse the way you think it does; the fixity of =<< is greater than $. You would need the shell-style parens if you insist on application instead of composition :) Prelude> :info $ ($) :: (a -> b) -> a -> b -- Defined in GHC.Base infixr 0 $ Prelude> :info =<< (=<<) :: (Monad m) => (a -> m b) -> m a -> m b -- Defined in Control.Monad infixr 1 =<< Prelude> :info . (.) :: (b -> c) -> (a -> b) -> a -> c -- Defined in GHC.Base infixr 9 . Incidentally, the parens in my example are actually unnecessary. Function application is about 10, and (.) is 9.