Am Mittwoch, 5. Dezember 2007 00:16 schrieb Per Gundberg:
Have you looked at the proposed view patterns? It seems like it would cover the case you gave here. I don't know if there's work being done in this area though.
http://hackage.haskell.org/trac/ghc/wiki/ViewPatterns
//Gundberg
I cannot resist citing Henning Thielemann (actually translating from German). The following text is from is very good squib about how to become a scripting language hater within five days [1]. Please take it with a grain of humor. I don’t want to offend anyone. Here’s the text:
The root idea of functional programming simplifies many things. No need to distinguish between constants and variables, no “call by reference”, no assignments, no predefined loop structures—everything is manageable and the effects of functions are controllable.
It is clear that this situation must not stay this way. Bit by bit, disciples of Perl and Python discover Haskell and demand that Haskell will be plastered with syntactic sugar until the simplicity of the functional approach isn’t visible anymore. Sadly, they seem to be successful with this as syntax extensions like parallel list comprehensions show.
Many Haskell newcomers don’t seem to bother studying the concept of functions and the wide variety of applications of higher order functions. They rather avoid everything systematic and construct their programs mainly from syntactic sugar like list comprehensions, guards, pattern guards, infix operators and do notation, optionally also with pettifogging recursions. Because they don’t know anything else, they aren’t tired of emphasizing how important such syntactic sugar is. In addition, the strict order of dataflow imposed by functions is attacked again and again. Yes, global variables are just immortal.
[1] <http://users.informatik.uni-halle.de/~thielema/ScriptingHater.html> Best wishes, Wolfgang