type t = M.t does not bring M.t's constructors into scope.  ppx_import (https://github.com/whitequark/ppx_import) can help with this if you don't mind preprocessing.

Hez

On Fri, Jul 15, 2016 at 2:58 PM Yotam Barnoy <yotambarnoy@gmail.com> wrote:
Ok I have to admit that's pretty convenient.

> On Jul 15, 2016, at 2:09 PM, Jeremy Yallop <yallop@gmail.com> wrote:
>
>> On 15 July 2016 at 17:57, Yotam Barnoy <yotambarnoy@gmail.com> wrote:
>> In haskell, I can just say 'import A (foo, bar, baz, t)' to limit
>> exactly what I want to import. This is because haskell has a
>> half-baked module system that isn't nearly as powerful as OCaml's,
>> which allows it to create syntax that doesn't need to go anywhere but
>> at the toplevel.
>>
>> We need this functionality in OCaml, but the closest thing is to say
>> 'include struct let foo = A.foo let bar = A.bar let baz = A.baz type t
>> = A.t end'
>
> This can be written more succinctly:
>
>   let foo, bar, baz = A.(foo, bar, baz)
>   type t = A.t

--
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs