
22 Feb
2005
22 Feb
'05
5:19 p.m.
Isaac Jones wrote:
John Goerzen
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