[Haskell-cafe] Re: new Haskell hacker seeking peer review

Dean Herington heringtonlacey at mindspring.com
Sat Feb 19 01:56:20 EST 2005


At 5:27 PM -0800 2/18/05, 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
>
>-- And a regular version for reference
>
>cat2 :: IO ()
>cat2 = do a <- getArgs
>           lines <- mapM readFile a
>           putStrLn $ concat lines
>
>
>peace,
>
>   isaac

You probably want `putStr` instead of `putStrLn`, as the latter 
introduces a gratuitous newline at the end of the concatenated 
contents.

Dean


More information about the Haskell-Cafe mailing list