This is the knowledge that OCaml modules are "just" existential types. What is there some kind of parity between
module X = struct type t val x : t end
and
data 'a spec = { x : 'a }
data x = X : 'a spec
and this is not entirely true.
But, as I just showed, OCaml has both modules and existential types. My question is:
- How do they differ?
- Is there anything that can be implemented in one and not the other?
- When do you use one on top of the other (in particular, comparing first-class modules with existential types)?
source
share