caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] parametric modules file layout
@ 2012-07-18  7:16 Ivan
  2012-07-18  8:19 ` Romain Bardou
  2012-07-18 14:16 ` Dan Bensen
  0 siblings, 2 replies; 3+ messages in thread
From: Ivan @ 2012-07-18  7:16 UTC (permalink / raw)
  To: caml-list


Hello!

I'm creating a functor named Forest that is parametrized by two modules: A - defines operations on assoc pair, and H - defines operations on hierarchical types. So I have three signatures : ASSOC, HIER, FOREST and one module Make. Each signature is rather large and needs to be defined both in mli and ml. 

I know, that with types the problem of code repetition can be solved by refactoring them in a separate module (a ml file with implicit mli). Is it a valid solution for signatures? Can I put a signature in the sig.ml file and then refer to it with  ``Sig.ASSOC?'' Or maybe there're other solutions or common practices to solve such problems?


Thanks, in advance.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] parametric modules file layout
  2012-07-18  7:16 [Caml-list] parametric modules file layout Ivan
@ 2012-07-18  8:19 ` Romain Bardou
  2012-07-18 14:16 ` Dan Bensen
  1 sibling, 0 replies; 3+ messages in thread
From: Romain Bardou @ 2012-07-18  8:19 UTC (permalink / raw)
  To: caml-list

On 18/07/2012 09:16, Ivan wrote:
>
> Hello!
>
> I'm creating a functor named Forest that is parametrized by two modules: A - defines operations on assoc pair, and H - defines operations on hierarchical types. So I have three signatures : ASSOC, HIER, FOREST and one module Make. Each signature is rather large and needs to be defined both in mli and ml.
>
> I know, that with types the problem of code repetition can be solved by refactoring them in a separate module (a ml file with implicit mli). Is it a valid solution for signatures? Can I put a signature in the sig.ml file and then refer to it with  ``Sig.ASSOC?'' Or maybe there're other solutions or common practices to solve such problems?
>
>
> Thanks, in advance.
>

I don't think there is any problem with that solution. It's what I would do.

Cheers,

-- 
Romain

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] parametric modules file layout
  2012-07-18  7:16 [Caml-list] parametric modules file layout Ivan
  2012-07-18  8:19 ` Romain Bardou
@ 2012-07-18 14:16 ` Dan Bensen
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Bensen @ 2012-07-18 14:16 UTC (permalink / raw)
  To: Ivan, caml-list

[-- Attachment #1: Type: text/plain, Size: 259 bytes --]

> three signatures : ASSOC, HIER, FOREST
> put a signature in the sig.ml file
> maybe there're other solutions or common practices

I don't know if this is common, but you could 
put them in separate .ml files and call the types 
ASSOC.T, HIER.T, and FOREST.T

[-- Attachment #2: Type: text/html, Size: 581 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-07-18 14:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-18  7:16 [Caml-list] parametric modules file layout Ivan
2012-07-18  8:19 ` Romain Bardou
2012-07-18 14:16 ` Dan Bensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).