4 ms·
Haskell has a tendency to require mathematics that is by itself wonky. Usually because they use category theory but neglect to mention that they're actually wor
by contravariant 4y ago
Haskell has a tendency to require mathematics that is by itself wonky. Usually because they use category theory but neglect to mention that they're actually working in a closed monoidal category (or perhaps cartesian closed, it's not 100% clear), and use currying implicitly everywhere.
This is why you even have an "Applicative" class of functors for instance, they're the ones that work nicely with the closed monoidal category structure. Somehow this detail gets skipped a lot in explanation of it (and you won't find it mentioned in mathematical texts).
- hither_shores 4y ago> This is why you even have an "Applicative" class of functors for instance, they're the ones that work nicely with the closed monoidal category structure. Applicatives still make sense with only monoidal structure: they're monoidal functors `C -> Set`, or more generally `C -> V` for `C` enriched over `V`.
- contravariant 4y agoI'd be interested to see a justification for that, given that the usual definition is essentially "A functor which preserves the internal hom functor". Regardless I hope you can see what I mean when I say the mathematics you need for Haskell is wonky.
- hither_shores 4y ago> I'd be interested to see a justification for that, given that the usual definition is essentially "A functor which preserves the internal hom functor". Applicatives are monoid objects for Day convolution of functors (in the same way that monads are monoid objects for composition of functors) given by the coend `F \otimes G (x) = \int^{i, j} Hom_C(i \otimes j, x) \otimes_V F(i) \otimes_V F(j)`. These coincide with closed functors by currying if we have closed monoidal structure, but remain well-defined without it. Using `<*>` instead of `liftA2` in the typeclass definition is basically a historical accident, and imo a mistake. > Regardless I hope you can see what I mean when I say the mathematics you need for Haskell is wonky. Wonky is too strong, but I agree that it's usually not treated with anything near the appropriate level of detail.