Isaac Jones wrote:
John Goerzen <[EMAIL PROTECTED]> writes:
Here's an alternative:

module Main where

(snip john's version)

And what list would be complete without a points-free version.  It
doesn't operate on stdin, though like John's does:

pointsFreeCat :: IO ()
pointsFreeCat = getArgs >>= mapM readFile >>= putStrLn . concat

Or why not the two characters shorter, but much less readable:

pointsFreeCat' = getArgs >>= mapM_ ((>>= putStr) . readFile)

or maybe:

pointsFreeCat'' = getArgs >>= mapM_ (putStr >>. readFile)

(>>.) :: (b -> IO c) -> (a -> IO b) -> a -> IO c
(>>.) = (.) . flip (>>=)

Is (>>.) in the standard libs? If not, should it be? I'm sure there is a shorter definition of (>>.) that I haven't thought of.

/Bjorn
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to