On Wed, Sep 15, 2010 at 3:40 PM, Gabriel Riba <[email protected]> wrote: > Error: This expression has type int but an expression was expected of type > MyInt.t
This is a feature, not a bug. By declaring MyInt to be of signature HAS_DOUBLE, you hide all implementation details of MyInt that do not appear in that signature. So, from the outside, one is not supposed to know that type t = int. To fix your code, there are plenty of possibilities, depending on what you want to do: * do not restrict MyInt to be of signature HAS_DOUBLE * declare "type t = int" in the signature HAS_DOUBLE * add a function of_int to the interface, of type int -> t, and change your call to MyInt.double (MyInt.of_int 5) * other ways I haven't thought of Johannes -- Johannes Kanig -- 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
