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] Recursive types and functors.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-03-26 (06:28)
From: David Brown <caml-list@d...>
Subject: [Caml-list] Recursive types and functors.
I have a recursive type where I'd like one of the constructors of the
type to contain a set of the type (or something like set).  However, I
can't figure out how to represent this.

For example:

type foo =
  | Integer of int
  | String of string
  | Set of FooSet

module FooSet = Set.Make (struct type t = foo let compare = compare end)

but this obviously doesn't work.

I suspect putting type foo in a functor can somehow make it work, but I
haven't quite figure out how to do it.

Dave Brown

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners