[Haskell-cafe] Re: new Haskell hacker seeking peer review
Bjorn Bringert
d00bring at dtek.chalmers.se
Tue Feb 22 17:19:46 EST 2005
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
More information about the Haskell-Cafe
mailing list