[Haskell-cafe] about Haskell code written to be "too smart"
Tim Newsham
newsham at lava.net
Tue Mar 24 14:10:04 EDT 2009
> 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.
>
> Since someone is starting to write the Haskell coding style, I really suggest
> him to take this "problem" into strong consideration.
When you think about it, what you are saying is that Haskell programmers
shouldn't take advantage of the extra tools that Haskell provides. Haskell
provides the ability to abstract code beyond what many other programming
systems allow. This abstraction gives you the ability to express things
much more tersely. This makes the code a lot harder to read for people
who are not familiar with the abstractions being used. This can be
overcome with practice and experience.
I'm not trying to say that code can never get too complex. Humans have
some complexity budget and its not too hard to push the limits and blow
your complexity budget. But that is true in any language. The ability to
abstract lets you factor out common patterns that are easy to reuse and
remember (with practice) and lets you spend your complexity budget
elsewhere. As a programmer you still need to use your judgement to
balance complexity against understandability.
[Obviously if you are writing code that you want to be readable by
people who arent well versed in common Haskell idioms, you'd limit
your use of abstractions.]
> Manlio
Tim Newsham
http://www.thenewsh.com/~newsham/
More information about the Haskell-Cafe
mailing list