English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] module types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-06-03 (18:33)
From: John Carr <jfc@m...>
Subject: Re: [Caml-list] module types

I also have a problem with module types.  Suppose I have

	module type T = sig type t val f : t -> string end

If I want to declare a module implementing this signature I can write

	module X : T with type t = int

but this similar declaration is not allowed

	module Y : T with type t = A | B | C

The manual implies this restriction is intentional, a result of not
allowing unnamed constructor types.  I also tried

	module Y : sig include T type t = A | B | C end

but the compiler considered this to be an illegal duplicate
definition of type t.

1. Is there a reason not to allow (A | B | C) as an anonymous
type declaration?

2. Is there a way to do what I want without declaring the type name
outside the module?  I prefer to limit the scope of type names.

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