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: skaller <skaller@u...>
Subject: Re: [Caml-list] My wishlist: DRY modules
On Thu, 2004-10-14 at 09:09, brogoff wrote:
> On Wed, 13 Oct 2004, Brian Hurt wrote:
> >
> > I'm doing some work with modules, and I'm learning some of their
> > annoyances.  Number one is having to repeat module type definitions.  For
> > example, say you have a file foo.  In foo.mli, you have:
> 
> It's annoying, but in the case you describe, just put the signatures
> in their own separate file (sigs.ml or whatever), then you refer to them as
> Sigs.T, Sigs.S, etc.,  and  you don't need to  repeat them, or change them in
> more than one place as you develop. If you do it that way, the annoyance
> becomes pretty small.

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 :(

Of course I can use ocamlc -i, but then I can't
apply any constraints. I'd like to be able
to instantiate a functor type too. Can this be done?

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
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