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 CAA16225; Thu, 27 Sep 2001 02:35:04 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id CAA16080 for ; Thu, 27 Sep 2001 02:35:03 +0200 (MET DST) Received: from favie.faith.gr.jp (favie.faith.gr.jp [61.127.175.250]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f8R0Z1f11287 for ; Thu, 27 Sep 2001 02:35:02 +0200 (MET DST) Received: from localhost (dhcp7.faith.gr.jp [192.168.1.17]) by favie.faith.gr.jp (8.9.3/8.9.3) with ESMTP id JAA04557; Thu, 27 Sep 2001 09:34:44 +0900 To: msk@post.tepkom.ru Cc: caml-list@inria.fr Subject: Re: [Caml-list] format types In-Reply-To: <01092512594301.08201@kouzdra.glokaya> References: <3BAFC45D.9EAB97D9@gmvnetwork.com> <01092512594301.08201@kouzdra.glokaya> X-Mailer: Mew version 1.94.2 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20010927093501F.garrigue@kurims.kyoto-u.ac.jp> Date: Thu, 27 Sep 2001 09:35:01 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > why > > let _ = List.map printf (["abc\n"; "def\n"]:('a,'b,'c) format list) > > work properly, but: > > let _ = List.map printf ["abc\n"; "def\n"] > > doesn't compiled with message > > This expression has type ('a, out_channel, unit) format -> 'a > but is here used with type string -> 'b > > I know, O'Caml format type is a hack, but I can't undertand difference > between thees two expressions for the type inference algorighm. You have the answer: this is a hack, and there are no guarantees anything will type (or have the expected side-effects) if you do not follow the documentation. If you understand how the hack works, then you can write the following (which does not seem very useful): # let map_printf l = List.map Printf.printf l;; val map_printf : ('a, out_channel, unit) format list -> 'a list = # map_printf ["abc"; "def"];; abcdef- : unit list = [(); ()] Jacques Garrigue ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr