[Haskell-cafe] Things to avoid (Was: Top 20 ``things'' to know in Haskell)

Iavor Diatchki iavor.diatchki at gmail.com
Thu Feb 10 19:18:19 EST 2005


> ...
> Yeah, as long as it is explained and clearly marked as an opinion (as
> it is now), that's ok. One reason that I got so excited about that is
> because I don't like the current situation with (n+k)-patterns:
> Everybody says they're evil, but hardly anybody can explain why he
> thinks so.

I think 'evil' may be a little too strong.  I think the usual argument
against 'n+k' patterns is that:
i) they are a very special case, and may be confusing as they make it
look as if '+' was a constructor, which it is not
ii) they lead to some weird syntactic complications, e.g.
x + 3 = 5 defines a function called '+', while (x + 3) = 5 defines a
variable 'x' to be equal to 2.
and there is other weirdness like:
x + 2 : xs = ...
does this define '+' or ('x' and 'xs')?  i think it is '+'.  anyways
when used as intended 'n+k' are cute.   it is not clear if the
complications in the language specification and implementaions are
worth the trouble though.

More information about the Haskell-Cafe mailing list