Hi! I've been writing code in ocaml that performs various forms of work over abstract algebra structures. I have been very happy with modules and functors which allow me to build these structures from algebraic rules. However, after slowly growing the type system which I need, I've run into several inefficiencies. I've attached ocaml file in question. The part that annoys me is how I keep having to make two of every module type. A normal version and a 'NotNested' version. For example, you'll see there is a RingNotNested and CommutativeRingNotNested in addition to a Ring and CommutativeRing signature. Notice that this mess finds its way into the functors which create these signatures as well (Make[Commutative]Ring). I've had to do this because ocaml (and sml) lack both: the ability to refine the signature of an 'included' module eg: include Ring with module Multiplication : AbelianMonoid the ability to rebind a module (the way variables can be re-bound) eg: module A = Foo ... code ... module A = Bar These features could lead to a more natural formulation, like: module type Ring = sig type t module Addition : AbelianGroup with type t = t module Multiplication : Monoid with type t = t val distributive : unit val zero : t val one : t val eq : t -> t -> bool val add : t -> t -> t val sub : t -> t -> t val neg : t -> t val mul : t -> t -> t end module type CommutativeRing = sig include Ring module Multiplication : AbelianMonoid with type t = t end Is there another way to simplify this code that I am not familiar with? Would one of the above changes be useful to people more than just me? -- Wesley W. Terpstra