* [Caml-list] renaming a type
@ 2001-09-13 13:52 Pascal Brisset
2001-09-14 6:12 ` Francois Pottier
0 siblings, 1 reply; 2+ messages in thread
From: Pascal Brisset @ 2001-09-13 13:52 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] renaming a type
2001-09-13 13:52 [Caml-list] renaming a type Pascal Brisset
@ 2001-09-14 6:12 ` Francois Pottier
0 siblings, 0 replies; 2+ messages in thread
From: Francois Pottier @ 2001-09-14 6:12 UTC (permalink / raw)
To: Pascal Brisset; +Cc: caml-list
> 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;;
> ^^^^^^^^^^^^^^^^
Why not do it in two steps?
# module M = struct type 'a t = T end;;
module M : sig type 'a t = T end
# type 'a t' = 'a M.t = T;;
type 'a t' = 'a M.t = T
# type t'' = int t';;
type t'' = int t'
Clearly very clumsy, of course, but it works.
--
François Pottier
Francois.Pottier@inria.fr
http://pauillac.inria.fr/~fpottier/
-------------------
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-09-14 6:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-13 13:52 [Caml-list] renaming a type Pascal Brisset
2001-09-14 6:12 ` Francois Pottier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox