3 ms·
> So, is there a simple and universal way to compose these functions? proceeds to add layers of complexity Why not just write a function to compose them? Argu
by Veedrac 9y ago
> So, is there a simple and universal way to compose these functions?
proceeds to add layers of complexity
Why not just write a function to compose them? Argue against the competition, not strawmen.
- WkndTriathlete 9y agoMost code that is written has effects - null returns, error returns, exceptions, IO, etc., etc. We can write a custom function to compose every pair of functions we write, but some clever people figured out there were patterns to this madness - map, flatMap, lift, return, etc. - and it's far more efficient to write those patterns once and reuse them. Essentially, it's DRY at a higher level of abstraction.
- Veedrac 9y agoYou still have to write each composition operator separately; writing the code to compose null returns doesn't give you the code to compose IO. Only difference is whether they have separate names.
- dllthomas 9y agoThat's not the only difference. You get to reuse any code written using only those names (that interface).