Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] type var in functor instance?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel_Bünzli <daniel.buenzli@e...>
Subject: Re: [Caml-list] type var in functor instance?
Hello,

Accidentally I'm running into the same problem. I'd like to have a 
polymorphic Hashtbl that uses physical equality. Using Hashtbl.Make is 
not possible since the type t of the input signature HashedType has no 
variable.

More precisely I would like to have a key with the following type

type 'a 'b key = 'a option * 'b option

and the following equal function,

let equal k k' = match k, k' with
| (Some x, y), (Some x', y') -> if x == x' then y = y' else false
| _, _ -> k = k'

which tests for physical equality when the first component of the key 
is "Some" in both keys.

Any hints besides those already suggested ?

Daniel

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