[Haskell-cafe] Function application like a Unix pipe
Tomasz Zielonka
tomasz.zielonka at gmail.com
Wed Nov 23 06:41:24 EST 2005
On Wed, Nov 23, 2005 at 11:17:25AM +0100, Udo Stenzel wrote:
> infixl 2 \|
> (\|) = flip (.) -- though I'm using (&)
>
> The unix pipe becomes (filter ("foo" `isPrefixOf`) \| sort \| nub) or
> something, which is rather neat, and (#) is used to call "member
> functions", as in
Why not use Control.Arrow.>>> ?
The instance for (->) is exactly what you want, and the syntax is quite
nice:
(filter ("foo" `isPrefixOf`) >>> sort >>> nub)
BTW, using sort before nub is a bit pointless. In fact, using nub for
longer lists is a bad idea.
Best regards
Tomasz
More information about the Haskell-Cafe
mailing list