[Ur] common type for different functor instantiations

Gergely Buday gbuday at gmail.com
Thu Oct 27 08:17:22 EDT 2011


> Sure: define [mRecord] outside the functor completely.  It could be an
> abstract type in an enclosing module.  (Modules can contain functors, which
> can contain modules that contain functors, and so on ad infinitum.)

Thinking about how to define the abstract type concretely, I would have

structure Enclosing =
struct

  datatype mRecord = First of $firstFields |
                                Second of $secondFields |
                                Third of $thirdFields

  datatype whichmodule = FirstM | SecondM | ThirdM

  functor Render ( M: sig ... val module : whichmodule ... end  ) : Signature =
  struct
  ...
  end

end

Do you agree with this, or, you would suggest something else?

- Gergely



More information about the Ur mailing list