Here's an attempt to clarify the question: I have a functor F and a functor G. I apply F to module M outside of G to create F', and within G I also apply F to M to create F''. Additionally, G is applied to M to create G'. How do I make the compiler understand that F' outside G' is the same as F'' inside G'? Yotam On Wed, Sep 3, 2014 at 1:20 PM, Yotam Barnoy wrote: > Working with ocaml's functional data structures has quickly become a job > of connecting different functors together, and I'd appreciate some help. > > I have the following layout: > > module rec OrderedKey : OrderedKeyType = struct > type t = Value.value_t > let compare = compare > let filter_idxs idxs = function > | Value.VTuple l -> Value.VTuple(list_filter_idxs idxs l) > | _ -> invalid_arg "not a vtuple" > end > > and ValueBag : IBag.S with type elt = Value.value_t = > IBag.Make(OrderedKey) > > and ValueMMap : IMultimap.S with type elt = Value.value_t and type bag = > ValueBag.t = > IMultimap.Make(OrderedKey) > > and Value : sig ... type value_t = ... end = Value > > The situation is as such: my multimap (IMultimap) contains an internal > specialization of the IBag functor called an InnerBag. It attempts to > return said bag, which is equivalent to the external ValueBag in structure. > However, I don't know how to tell ocaml that the type 'bag' which is > abstract in IMultimap is exactly the same as the external ValueBag. I tried > to do that above, but what I get is a mismatch between IMultimap's internal > InnerBag.t and the external ValueBag.t. > > Any help would be appreciated. > > Yotam > >