Haskell confusion (81)

79 Name: #!/usr/bin/anonymous : 2006-04-22 10:37 ID:DarU6rvQ

>>78
And that is why it is generally considered a good idea to provide an explicit type declaration for all exported symbols in a Haskell module. Abuse of point-free style one component of the Haskell equivalent of spaghetti code.

Anyway, the real value of point-free code is that there are fewer bits that you need to remember, or look at, that way. This makes sense if you consider that most haskellers can remember map, foldl, etc basic stuff like a perl programmer knows his regexps. (I'm sure a cognitive psychologist could make some obsure point here about humans having a short term memory limit of 7 "things".)

Which definition of strUpper would you consider clearer?

strUpper str = map (\x -> toUpper x) str

or

strUpper = map toUpper

The first has seven words (plus the arrow and lambda-backslash symbols), apart from the equals sign which tends to disappear anyway, vs only three for the second.

This thread has been closed. You cannot post in this thread any longer.