From: Alain Frisch <alain@frisch.fr>
To: caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] recursive module and types
Date: Thu, 20 May 2010 00:58:17 +0200 [thread overview]
Message-ID: <4BF46D09.1000206@frisch.fr> (raw)
In-Reply-To: <4BF3D87D.6010805@univ-savoie.fr>
On 05/19/2010 02:24 PM, Christophe Raffalli wrote:
> Does anyone see a way to avoid it
I propose:
module rec T : sig
type t = U.t
val compare : t -> t -> int
end = struct
include U
let compare u v = match u, v with
Leaf, Leaf -> 0
| Node u', Node v' -> S.compare u' v'
| Leaf, Node _ -> -1
| Node _, Leaf -> 1
end
and S : Set.S with type elt = T.t = Set.Make(T)
and U : sig
type t =
Node of S.t
| Leaf
end = U
The type definition is given only once.
-- Alain
prev parent reply other threads:[~2010-05-19 22:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-19 12:24 Christophe Raffalli
2010-05-19 22:58 ` Alain Frisch [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=4BF46D09.1000206@frisch.fr \
--to=alain@frisch.fr \
--cc=caml-list@yquem.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