Version française
Home     About     Download     Resources     Contact us    
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 <skaller@users.sourceforge.net>

> 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 caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners