On 4/13/07, daniel.c.buenzli <[EMAIL PROTECTED]> wrote:
>
> It depends if you need to assume operations on the 'a type to
> do_stuff. If it is the case then you need to use a functor. Otherwise,
> if 'a just decorates t then you don't and (a) is certainly better from
> a usability point of view.

I actually need a functor either way... I just used 'a type for
simplicity in the first example.  It would be better written as:

module type User = sig
  type user
  val do_user_stuff: user -> unit
end

module M(User: User) = struct
  type t
  val create: User.user -> t
  val do_stuff: t -> unit  (* uses User.do_user_stuff *)
  val get_data: t -> User.user
end

So the question is really, should the user define the datatype
structure or should the library?

Thanks,
Chris

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ocaml-developer" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/ocaml-developer?hl=en
For other OCaml forums, see http://caml.inria.fr/resources/forums.en.html
-~----------~----~----~----~------~----~------~--~---

Reply via email to