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] renaming a type
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-09-13 (13:52)
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 ?

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