caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pietro Abate <Pietro.Abate@pps.jussieu.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] small typing problem with modules ...
Date: Tue, 26 May 2009 15:12:23 +0200	[thread overview]
Message-ID: <20090526131223.GA7428@uranium.pps.jussieu.fr> (raw)
In-Reply-To: <4A1BE27E.8030908@cea.fr>

On Tue, May 26, 2009 at 02:37:18PM +0200, Julien Signoles wrote:
> >but then I'm a bit lost putting all this together ... 
> >I know I'm close ... a small hint ?
> Hum, module types cannot be parameterized. If you want to use a functor 
> signature, you can write the following :

uhmmm I was wondering ... :)

> =====
> module type T =
>   functor (Extra : A.Extra) ->
>   functor (A : A.T with type extra  = Extra.t) ->
>   sig val f : A.extra -> unit end
> 
> module Make : T
> 
> open A
> val f : extra -> unit
> =====
> 
> But I'm pretty sure that is not really what is expected...
> However why cannot you just add an another abstract type in your 
> signature like below?

well it does not solve the duplication problem as I cannot write
something like :

include T (A.ExtraDefault) (A)

as we don't have functorized module types as you pointed out. you just
moved the functor signature to the type T ...

> =====
> module type T = sig
>   type extra
>   val f : extra -> unit
> end
> 
> module Make(Extra : A.Extra)(A : A.T with type extra  = Extra.t)
>   : T with type extra = A.extra
> 
> open A
> val f : extra -> unit
> =====

ok, I can do that, but it would be still annoying as the module A might
contain a lot of types that I would need to add to the signature T in
b.mli . Something like :

 module type T = sig
     type a
     type b 
     ...
     type n
     val fa : a -> unit
     val fb : b -> unit
     ...
     val fn : n -> unit
 end    

but this should solve the duplication problem as I can now write
something like

include T with type extra = A.extra ( .... and all other types .... )

I'm still not really satisfied with this solution, but I'm now worried
that with the current syntax is just not possible to solve my problem...

thanks :)
pp


  reply	other threads:[~2009-05-26 13:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-26  9:37 Pietro Abate
2009-05-26 12:37 ` [Caml-list] " Julien Signoles
2009-05-26 13:12   ` Pietro Abate [this message]
2009-05-26 13:35   ` Andreas Rossberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090526131223.GA7428@uranium.pps.jussieu.fr \
    --to=pietro.abate@pps.jussieu.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).