modification to the O'CaML sets.ml

From: Benoit deBoursetty (b-db@graphics.lcs.mit.edu)
Date: Tue May 18 1999 - 01:53:39 MET DST


Date: Mon, 17 May 1999 19:53:39 -0400 (EDT)
From: Benoit deBoursetty <b-db@graphics.lcs.mit.edu>
To: Caml mailing list <caml-list@inria.fr>
Subject: modification to the O'CaML sets.ml
In-Reply-To: <199905141108.NAA02693@pauillac.inria.fr>

Those who need the 1-type-variable polymorphic set data structure I've
talked of recently will find this file useful :

http://www.polytechnique.fr/eleves/1996/boursetty/polyset.ml

!! Warning !! The URL will stop being effective at the beginning of July.
Would anyone download this very small file to a more persistent website ?

It is a small modification to the original set.ml

In fact, only type declarations are modified, the code is just the same.
Doesn't this mean that the compiler polymorphism handling could be
enhanced ?

In the case of sets I feel like declaring something like

(* This is not valid o'caml *)
module type 'a Comparison =
  sig
    val compare : 'a -> 'a -> int
  end

and a functor from modules with type 'a Comparison to modules with type

(* Neither is this *)
module type 'a Set =
  sig
    type 'a t
    val empty: 'a t
    val is_empty: 'a t
    val mem: 'a -> 'a t -> bool
    val add: 'a -> 'a t -> 'a t
  .
  .
  .
  end

That is only my personal, programmer's point of view. I don't know of the
typing problems behind it.

Benoit de Boursetty



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:22 MET