3 ms·
Another component of this: _mathematically sound_* patterns do seem to be useful. You can see this in most languages in the shape of list comprehensions, LINQ &
by moomin 8y ago
Another component of this: _mathematically sound_* patterns do seem to be useful. You can see this in most languages in the shape of list comprehensions, LINQ &c, and in Haskell in Monoids, Functors and so on.
I think the big difference is: you can reason about these constructs at a higher and composable level, but patterns are just tricks of the trade that don’t compose into large patterns.
Seen from this perspective, patterns are folk remedies, re-usable data structures are medicine.
*or at least, close enough that they’re useful.
- marcosdumay 8y agoList comprehension functions are just that: functions. Monoids, Functors and etc are type classes, some semantic element of a language. List comprehension syntax is a DSL with some specific capabilities. None of that is a pre-made structure one would impose on code. Those are all functionality that the language makes available for you to use when desired.
- moomin 8y agoI’m not sure how you think a typeclass differs from a pre-made structure you impose on code. The average typeclass has parts that are enforced by the compiler and “laws” which aren’t. The functionality you describe is provided only when you conform to the pattern required by the library/compiler. I don’t think the division is as cut and dried as you set out.