Can ML functors be practically expressed with .NET interfaces and generics? Is there an advanced ML functor use example that defies such encodings?

Answers summary:

In the general case, the answer is NO. ML modules provide features (such as specification sharing via signatures [1]) that do not directly map to .NET concepts.

However, for certain use cases the ML idioms can be translated. These cases include not only the basic Set functor [2], but also the functorial encoding of monads [3], and even more advanced uses of Haskell, such as finally tagless interpreters [4, 5].

Practical encodings require compromises such as semi-safe downcasts. Your mileage will wary.

Blogs and code:

  1. blog.matthewdoig.com
  2. higherlogics.blogspot.com
  3. monad functor in F#
Edit
Report