OCaml Functors as Interfaces Take 2

We left off in a rather unsatisfying predicament, we can simulate OCaml functors with interfaces, but at the expense of passing in two type parameters and guarding all our functions with type constraints.  Yuck!

 

OCaml Functors as Interfaces

The following page describes in detail the differences between the OCaml and F# languages. It’s a good read for anyone familiar with OCaml and an even better read for those who are not.  For the first line of the summary declares

F#un with Phantom Types

With Halloween tomorrow, now is the perfect time to take a look at phantom types in F#.  So what are phantom types?  Think of them as a way to embed a constraint into the type system of a language.  Here’s a great example of using them [...]