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
[newbie] Define and use records in sum types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-08-03 (13:14)
From: Michael Welsh Duggan <md5i@c...>
Subject: Recursive Sets?
I have been trying to create a recursive type which can express sets
of itself.  The following code is not meant to be correct (it isn't),
but hopefully expresses the sort of thing I want to do.  Can someone
throw some ideas at me?

type foo = 
  | A | B 
  | Set of FooSet.t

module OrderedFoos =
    type t = foo
    let compare (a:t) (b:t) = compare a b

module FooSet = Set.Make(OrderedFoos)

Michael Duggan