MoreFun

MoreFun is an acronym for "MORE FUN with ml by using MORE FUNctors". It is a preprocessor for OCaml. Porting to other members of the ML-family should be possible; the only requirement is that something like "let module M = ... in" is allowed but fully first class modules are not required (e.g. no type constraints on or pattern matching with local modules are used). Without 'let module ...' the generated code looks extremely ugly.

Overview

MoreFun enables some candy like overloading functions and operators. Like in Haskell or C++ we can print values without having to deal with cumbersome format strings:

stdout << 42 << " is just a number and  " <<  (3,5) << " is a tuple of two integers" << End;;

But the real use is in overloading functors. By going through an overloaded functor we can overload everything that is allowed in a module -- not just values but also types, signatures and modules.

xxxxxxxxxxxxxxxxxxxxxx REMAINDER IS UNDER CONSTRUCTION xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Basic Idea

Test cases

The most important test case and sole reason for the creation of MoreFun is p2f.

Comparison with Haskell

Comparison with MetaOcaml

Comparison with C++

Implementation and organization of source code

mbuf

The OCaml compiler uses a lot of impure code to gain speed. This becomes a problem when we try to type check in presence of overloading. All but one variant of an overloaded entity are allowed to fail type checking, but due to the impure code some changes from the last variant would be still around when we try to check the next one. Rewriting the whole compiler to use a pure, functional style seemed to much of an effort. The easy way is to isolate the changes done for checking one variant from the rest while still using impure code.