Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Sven LUTHER <LUTHERSV@e-i.com>
To: caml-list@inria.fr
Subject: Types construits et interface de modules
Date: Wed, 19 Aug 1998 10:33:31 +0200	[thread overview]
Message-ID: <35DA8DDB.4BBB1E59@e-i.com> (raw)

Bonjour, ...
Hello, ...

est -il possible de faire la chose suivante en caml ?
is it possible to do something like that in caml ?

module type T = sig
	type t = A | B
	end
module A = struct
	type t = A | B
	end
module B = struct
	type t = A | B | C
	end

module F (M:T) = struct
	type t = M.t
	end

module MA = F (A)
module MB = F (B)

cela ne marche pas car les types t = A | B et t = A | B | C sont
differents
this don't work because the types t = A | B and t = A | B | C are
different

cependant il est possible de faire :

module type T = sig
	type t
	val a : t
	val b : t
	end

module A = struct
	type t = A | B
	let a = A
	let b = B
	end

module B = struct
	type t = A | B | C
	let a = A
	let b = B
	let c = C
	end

module F (M:T) = struct
	type t = M.t
	let a = M.a
	let b = M.b
	end

module MA = F (A)
module MB = F (B)

en, quoi les constructeurs de types sont-ils differents des fonctions ?
Ils ne sont pas propres a chaque type (en effet dans type t = A | B type
t' = A | C, t'.A ecrase t.A).
Il serait interressant de pouvoir definir automatiquement les
constructeurs dans l'interface du module.

in what are the type constuctors different from function symbols ?
they don't belong only to the corresponding type, but to the whole
module.
it would be nice to be able to define also the type constructors in the
interface of a module.

module A = struct
	type t = A |B
	end 

aurrais le type :
would have the following type :

sig type t val A : t val B : t end

Est ce que cela pose des probleme grave, ou ne s'agit-il que de sucre
syntaxique autour de l'implementation actuelle ?

Would this bring serious problems, or is it just syntaxic sugar over the
actual state of things ?


Amicalement,

Sven LUTHER





             reply	other threads:[~1998-08-19 23:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-08-19  8:33 Sven LUTHER [this message]
1998-08-20  6:17 ` boos
1998-08-31  9:47 ` Xavier Leroy
1998-08-31 10:05 LUTHER Sven

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=35DA8DDB.4BBB1E59@e-i.com \
    --to=luthersv@e-i.com \
    --cc=caml-list@inria.fr \
    --cc=luther@dpt-info.u-strasbg.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