From: Julien Signoles <Julien.Signoles@lri.fr>
To: Damien <Damien.Pous@ens-lyon.fr>
Cc: Caml List <caml-list@pauillac.inria.fr>
Subject: Re: [Caml-list] module types
Date: Fri, 4 Jun 2004 10:41:07 +0200 (MEST) [thread overview]
Message-ID: <Pine.LNX.4.43.0406041040070.23346-100000@pc8-119.lri.fr> (raw)
In-Reply-To: <20040603192619.2a50e1f5@mostha>
> module type T = sig type 'a t end
> module F(M: T): sig
> type a
> type t = a M.t
> (* plus a lot of values... *)
> end = struct
> type a = unit
> type t = unit M.t
> end
>
> I would like to re-write it like this :
>
> module type T = sig type 'a t end
> module type O =
> sig
> type a
> type t
> (* plus a lot of values... *)
> end
> module F(M: T): O with type t = a M.t =
> struct
> type a = unit
> type t = unit M.t
> end
>
> but I can't, because "a" is unknown...
> (of course, I want to keep it abstract)
>
> any idea ?
I already encountered this problem a while ago. I solved it by using the
following technic:
module type T = sig type 'a t end
module type O = sig type a type t end
type b = unit
module F(M:T): O with type t = b M.t and type a = b =
struct
type a = unit
type t = unit M.t
end
In the signature of the above structure, [b] should be abstract in order
to keep [a] abstract. Sadly, this technic introduces a new type definition
but I don't see a better way to solve this problem.
Hope this helps,
Julien Signoles
--
mailto:Julien.Signoles@lri.fr ; http://www.lri.fr/~signoles
"In theory, practice and theory are the same,
but in practice they are different" (Larry McVoy)
-------------------
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
prev parent reply other threads:[~2004-06-04 8:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-03 17:26 Damien
2004-06-03 18:33 ` John Carr
2004-06-03 23:13 ` skaller
2004-06-04 8:41 ` Julien Signoles [this message]
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=Pine.LNX.4.43.0406041040070.23346-100000@pc8-119.lri.fr \
--to=julien.signoles@lri.fr \
--cc=Damien.Pous@ens-lyon.fr \
--cc=caml-list@pauillac.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