Bjorn Bringert | 22 Feb 23:19
Picon
Picon

Re: Re: new Haskell hacker seeking peer review

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

Gmane