[Haskell-cafe] One question...

Waldemar Biernacki wb at sao.pl
Sun Dec 10 04:46:37 EST 2006

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
	[ f ] <- getArgs
	s <- readFile f
	putStr s

is more readable but a longer than that in Perl:

open f, "<$ARGV[0]";
while ( <f> ) { print }

Is it possible to make the Haskel code shorter?
How to join the three line in one? Is it possible?
What about the check if there exists referred file?
In Perl it could look like:
if ( open f, "<$ARGV[0]" ) {
	while ( <f> ) { print }
and is still shorter than that in Haskell. 

I have to admit that I think that as shorter source code as better.
Therefore the question to those who know Perl: is the source code of a 
client-server application shorter in Haskel to compare to Perl one? 
How much shorter (more or less)? 
Is that source code really easier to debug (in OO Perl it is not really 
easy :-( 


More information about the Haskell-Cafe mailing list