Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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 Archives:
Bug reports: FAQ:
Beginner's list: