Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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.

Thanks,
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