how to coerce expression type?

From: Dwight VandenBerghe (
Date: Mon Dec 21 1998 - 18:17:06 MET

Message-Id: <>
Date: Mon, 21 Dec 1998 09:17:06 -0800
From: Dwight VandenBerghe <>
Subject: how to coerce expression type?

I am converting older ocaml code to version 2.01, and
find that many expressions that passed through the previous
compilers fine now exhibit warning errors due to not being
of unit type. This happens when I evaluate an expression
for its side effects (the horror, the horror). Here's an

  let is_in_table table key =
         Hashtbl.find table key;
     with Not_found -> false;;

I don't want the result back from the lookup, I just want
to know if the key was present. So how do I "cast" the
find operation to unit, to quiet the warnings? I've tried
everything I can think of, things like

         (Hashtbl.find table key) : ()

but have not yet hit upon the magic incantation.

Thank you.


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