Re: Use "with type" with functorial signatures
| Newsgroups | gmane.comp.lang.ocaml.beginners |
|---|---|
| Message-ID | <CAOOOohQ_eutUvo0VQuDEm53ujqnNVccZ6nkJmeRiX-7n513qpQ@mail.gmail.com> |
Hi Chantal, Not sure you can have what you want, in particular I expected the following to work module type BAR = sig type t end module type FOO = functor (Bar:BAR) -> sig type u type t = Bar.t end module Make(Foo:FOO)(Bar:BAR) : Foo(Bar) with type u = string but it does not: Error: Ill-typed functor application Foo(Bar) The closest I can see is this: module type BAR = sig type t end module type FOO = sig type u type t end module Make(Bar:BAR) : FOO with type u = string and type t = Bar.t This is already an advanced question, I suggest you ask on the caml-list. Philippe. 2014-06-02 16:09 GMT+02:00 Chantal Keller [email protected] [ocaml_beginners] <[email protected]>: > Dear OCaml users, > > In a .mli file, I can write the following: > > > module type BAR = sig > type t > end > > module type FOO = functor (Bar:BAR) -> sig > type u > type t = Bar.t > end > > module Make : FOO > > > but I would like to specialize the last line to express the following > idea: > > > module Make : FOO with type u = string > > > Is it possible without expanding the signature FOO? > > Thanks in advance, > Chantal. > > > ------------------------------------ > Posted by: Chantal Keller <[email protected]> > ------------------------------------ > > Archives up to December 31, 2011 are also downloadable at > http://www.connettivo.net/cntprojects/ocaml_beginners > The archives of the very official ocaml list (the seniors' one) can be > found at http://caml.inria.fr > Attachments are banned and you're asked to be polite, avoid flames > etc.Yahoo Groups Links > > > >