[Haskell-cafe] Function application like a Unix pipe
Scherrer, Chad
Chad.Scherrer at pnl.gov
Wed Nov 23 12:01:07 EST 2005
Udo Stenzel <u.stenzel at web.de> writes:
> The unix pipe is actually function composition. Its argument
> (standard
> input) isn't explicitly mentioned
Then it seems Unix must overload the "|" operator. I typically use it to
do things like
grep "." *.hs | wc
So I think of the types as being
grep "." *.hs :: String
wc :: String -> Int -- ok, not really, but it shows the point better.
So we'd have to have
(|) :: a -> (a -> b) -> b
And (flip ($)) is the only thing that makes sense. Is it the case that a
Unix pipe is analagous to (flip ($)) or (flip (.)) depending on the
context?
Chad Scherrer
Computational Mathematics Group
Pacific Northwest National Laboratory
"Time flies like an arrow; fruit flies like a banana." -- Groucho Marx
More information about the Haskell-Cafe
mailing list