Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] My wishlist: DRY modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list] My wishlist: DRY modules
From: skaller <>

> But can you do that with functor instances?
> When I write something like:
> module IntSet = Set.Make(struct type t = int end)
> but type of IntSet is be spelled out long hand
> in the mli file. This is far worse than merely
> reflecting the interface of a module you wrote
> by hand -- it also breaks with upgrades to
> the library :(

In the interface, you just write:
  module IntSet : Set.S with elt = int

So you see that as long as you have the right signature defined
somewhere, your interfaces are going to be pretty short.

My main grudge is that an interface is not a signature, so you cannot
write things like:
  module MyList : List
while you can create an interface from a signature
  (* myList.mli *)
  include ListSig

Jacques Garrigue

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: