* Nested modules with equal types
@ 2010-04-29 17:20 Dennis Walter
2010-04-29 17:45 ` [Caml-list] " Goswin von Brederlow
0 siblings, 1 reply; 2+ messages in thread
From: Dennis Walter @ 2010-04-29 17:20 UTC (permalink / raw)
To: caml-list
Hi,
is there a way in OCaml to define nested modules where a type t of the
inner module is defined as equal to the out type of the same name?
For example, I would like to define a file outer.ml containing
type t
module Inner :
sig
type t = t
end
but I get the error
Error: The type abbreviation t is cyclic
which kind of makes sense. Can I somehow refer to Outer.t in the Inner
module? (Outer.t does in fact not work either).
Thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] Nested modules with equal types
2010-04-29 17:20 Nested modules with equal types Dennis Walter
@ 2010-04-29 17:45 ` Goswin von Brederlow
0 siblings, 0 replies; 2+ messages in thread
From: Goswin von Brederlow @ 2010-04-29 17:45 UTC (permalink / raw)
To: Dennis Walter; +Cc: caml-list
Dennis Walter <dennis.walter@gmail.com> writes:
> Hi,
>
> is there a way in OCaml to define nested modules where a type t of the
> inner module is defined as equal to the out type of the same name?
>
> For example, I would like to define a file outer.ml containing
>
> type t
> module Inner :
> sig
> type t = t
> end
>
> but I get the error
> Error: The type abbreviation t is cyclic
> which kind of makes sense. Can I somehow refer to Outer.t in the Inner
> module? (Outer.t does in fact not work either).
>
> Thanks!
type t
module Inner =
struct
type tmp = t
type t = tmp
end
MfG
Goswin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-04-29 17:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-29 17:20 Nested modules with equal types Dennis Walter
2010-04-29 17:45 ` [Caml-list] " Goswin von Brederlow
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox