Answering this question , I realized that Haskell allows you to deconstruct an object when declaring a function and use it to define parallel functions.
Basically, imagine that I would like to do something like this
a = (1+) b = (2+) c = (3+) d = (4+) e = (5+)
What will be the DRYest way to write it? I mean, all the templates are the same: the function name cannot be guessed by the amount to be added, but I should be able to avoid writing + every time (without using the Haskell template, of course).
Basically, I would like to be able to use map or something similar, and it seems that map just works !.
[a,b,c,d,e] = map (+) [1..5]
Et voila!
This is much shorter and perhaps more expressive, and it works:
> a 10 11 > b 10 12 etc ...
So my question is: is it good to use (in such a situation), and if not, is there a downside (I know that buying experience is equivalent in Ruby ) is a nightmare, but the reasons do not seem to apply to Haskell)?
Update
I understand that the readability of such code is subjective and can be considered as based on opinions. However, there may be some objective reasons for not doing this. For example, in Ruby (at least 1.8), methods defined with define_method are invisible to most IDE and tag developers. Moreover, you cannot enter them using a debugger, etc., which makes them really inconvenient in practice. I ask for a similar reason in Haskell