> In contrast in OCaml functors are module functions. Do modules form categories?
Wrong kind of functor, I believe.
Unfortunately, functor actually refers to a whole heap of different terms in various mathematical fields.
Ocaml's functor seems to come from Quine's predicate functor logic, or a related field like combinatory logic.
Thanks! The main point against Haskell functors being 'proper' is that they only work in the category of 'Hask'.
well, there is always: https://github.com/mikeizbicki/subhask which provides more flexibility on the categories you are programming in.
I think that is not accurate. Haskell's notion of a functor is basically taken from category theory. Same with applicative functor. It is easy to draw commutative diagrams for things like `Maybe` or `Either a` to prove it!
In contrast in OCaml functors are module functions. Do modules form categories? Maybe? I haven't seen anyone talking about category of OCaml modules. Perhaps in some papers. But even if they do I wouldn't call OCaml's claim better. When one says Functor in Haskell it is generally understood as "the category theory thing". When one says functor in OCaml I think most people, myself included, would think "module function", whether it satisfies category-theory requirements or not.
Also, worth pointing out that OCaml too has applicative functors. Those are such functors that when applied to same modules produce same types. Whether that fits with the category-theoretic notion of applicative functor... haven't thought about that! Maybe?
Basically
then if `M1.t` is the same as `M2.t` for some `t` the we have an applicative functor. The other side of the coin are generative functors: each time you apply them they mint new types: Then `M1.t` /= `M2.t`. This has been introduced in OCaml `4.02`