[Haskell-cafe] about Haskell code written to be "too smart"

Manlio Perillo manlio_perillo at libero.it
Tue Mar 24 14:51:10 EDT 2009


Jake McArthur ha scritto:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Manlio Perillo wrote:
> | These friends are very interested in Haskell, but it seems that the main
> | reason why they don't start to seriously learning it, is that when they
> | start reading some code, they feel the "Perl syndrome".
> |
> | That is, code written to be "too smart", and that end up being totally
> | illegible by Haskell novice.
> |
> | I too have this feeling, from time to time.
> 
> I used to think this as well, but have since changed my mind about most
> cases. 

The same for me.

 > [...]
> All these factors combined just means that you have to concentrate
> just as hard to understand one line of Haskell as you might 10 or 20
> lines of other languages. There is 10 or 20 times the amount of 
> information.
> 

This is right.
The problem is that often (IMHO) a function definition can be rewritten 
so that it is much more readable.

As an example, with the takeList function I posted.

In other cases, you can just break long lines, introducing intermediate 
functions that have a descriptive name *and* a type definition.

Doing this is an art, but a coding style for Haskell should try to 
document this.

 > [...]


Manlio


More information about the Haskell-Cafe mailing list