[Haskell-cafe] One question...

Stefan O'Rear stefanor at cox.net
Sun Dec 10 04:53:51 EST 2006


On Sun, Dec 10, 2006 at 10:46:37AM +0100, Waldemar Biernacki wrote:
> Thank you all of you,
> 
> your remarks and commants are very useful for me. 
> I'm starting to studying Haskell!
> 
> My first comparison to (my preferred) Perl is to show file on 
> the screen:
> 
> The Code in Haskell:
> 
> =====================
> import System
> main=do
> 	[ f ] <- getArgs
> 	s <- readFile f
> 	putStr s
> =====================
> 
> is more readable but a longer than that in Perl:
> 
> =====================
> open f, "<$ARGV[0]";
> while ( <f> ) { print }
> =====================

import System;main=getArgs>>=readFile.head>>=putStr

* Do notation has been reduced to monadic combinators
* Layout rule is not used


More information about the Haskell-Cafe mailing list