Singleton list confusion
Revision as of 07:16, 11 April 2008 by Lemming
Why do Haskell newcomers frequently believe, that list variables must be enclosed in brackets?People sometimes write argument patterns like
, hoping that
will assume all values of a list successively.
case xs of [x] -> [f x]
although they meant
[f x | x <- xs]
map f xs
It seems like they expect some kind of list comprehension.However, if there wouldn't be a special list notation and if there wouldn't be the special syntax for the list type constructor (thus we must write
then there would be certainly less confusion.