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
Nested modules with equal types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-04-29 (17:45)
From: Goswin von Brederlow <goswin-v-b@w...>
Subject: Re: [Caml-list] Nested modules with equal types
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 =
  type tmp = t
  type t = tmp