Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] renaming a type
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pascal Brisset <brisset@r...>
Subject: [Caml-list] renaming a type

 I want to alias a type outside a module in order to use it easily
without opening the module.
 For example

sepia[211]% ocaml
        Objective Caml version 3.01

# module M = struct type t = T end;;
module M : sig type t = T end
# type t' = M.t = T;;
type t' = M.t = T
# T = M.T;;
- : bool = true

 Unfortunately it does not work is I instantiate a polymorphic type with the
same idea:

# module M = struct type 'a t = T end;;
module M : sig type 'a t = T end
# type t' = int M.t = T;;
       ^^^^^^^^^^^^^^^^
The variant or record definition does not match that of type int M.t

Is there a workaround to get the expected result: writing, without prefixing
the module name, values of a type defined in a module and aliased outside ?

--Pascal
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr