22 Feb 23:19
Re: Re: new Haskell hacker seeking peer review
Bjorn Bringert <d00bring <at> dtek.chalmers.se>
2005-02-22 22:19:46 GMT
2005-02-22 22:19:46 GMT
Isaac Jones wrote: > John Goerzen <jgoerzen <at> complete.org> 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
RSS Feed