Browse thread
modification to the O'CaML sets.ml
- Benoit deBoursetty
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Benoit deBoursetty <b-db@g...> |
| Subject: | modification to the O'CaML sets.ml |
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