From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA20728; Mon, 21 Oct 2002 17:23:43 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA20059 for ; Mon, 21 Oct 2002 17:23:42 +0200 (MET DST) Received: from ns.lami.univ-evry.fr (ns.lami.univ-evry.fr [195.221.162.248]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g9LFNf522186 for ; Mon, 21 Oct 2002 17:23:42 +0200 (MET DST) Received: from lami.univ-evry.fr (chandler.info.lami.univ-evry.fr [192.168.162.75]) by ns.lami.univ-evry.fr (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id QAA26105 for ; Mon, 21 Oct 2002 16:23:36 +0200 X-Authentication-Warning: ns.lami.univ-evry.fr: Host chandler.info.lami.univ-evry.fr [192.168.162.75] claimed to be lami.univ-evry.fr Message-ID: <3DB41BFF.4010302@lami.univ-evry.fr> Date: Mon, 21 Oct 2002 17:23:43 +0200 From: Julien Cohen User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4) Gecko/20011126 Netscape6/6.2.1 X-Accept-Language: en-us MIME-Version: 1.0 To: caml-list@inria.fr Subject: [Caml-list] inference and phantom types Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I read in the thread http://caml.inria.fr/archives/200109/msg00097.html that phantom types could be used in ocaml but I have some troubles understanding the way they really work. In the following session I use a phantom type ('a,'b)t to simulate a list with an additionnal type 'b. I create a special cons preserving the type. I create an (int,bool)t value and when I make a cons on it and the phantom type seems not to be well infered: Objective Caml version 3.04 # type ('a,'b) t = 'a list;; type ('a, 'b) t = 'a list # let f (x:'a) (y:('a,'b) t) = (x::y : ('a,'b) t);; val f : 'a -> ('a, 'b) t -> ('a, 'b) t = # let (v: (int,bool) t) = [1];; val v : (int, bool) t = [1] # f 1 v;; - : (int, '_a) t = [1; 1] Is there a fundamental reason for the bool type not to be inferred? (no response in the ocaml-beginner list) Thanks Julien Cohen ------------------- 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