2 ms·
List comprehension functions are just that: functions. Monoids, Functors and etc are type classes, some semantic element of a language. List comprehension synta
by marcosdumay 8y ago
List 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.