Re:Why We Use OCaml
by tel on Wednesday July 16, 2014 @06:58PM
(#8045100)
Jon mentioned modularity, so what I imagine he's talking about is functors. They have a scary name (and no relation to Haskell functors) so you might rather call them parametric signatures and they allow one signature to depend upon a previously defined one. Ultimately that means that you can decompose signatures into constituent, reusable parts which is nifty sounding but transformative in how you express APIs
[ Parent
| on HN ]
Re:Why We Use OCaml
by jonsterling on Wednesday July 16, 2014 @07:51PM
(#8045258)
Functors are not parameterized signatures: they do not allow a signature to depend upon another signature, but rather a structure to depend on another structure. (However, SML/NJ has an extension called `funsig` which does what you have described).
Oomph. That's what I get for talking about OCaml after not using it for a really long time, s/signature/struct/.
How is it that they have no relation to Haskell functors?
> Functors are, roughly speaking, functions from modules to modules (https://realworldocaml.org/v1/en/html/functors.html)
Functors in haskell have functions (fmap) that take a value (a function) from one category into another.
Are they not at least the same Functor as in Category Theory?