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 LAA05602; Sun, 3 Nov 2002 11:31:59 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA05712 for caml-list@pauillac.inria.fr; Sun, 3 Nov 2002 11:31:59 +0100 (MET) 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 IAA03169 for ; Sun, 3 Nov 2002 08:09:00 +0100 (MET) Received: from students.mimuw.edu.pl (zodiac.mimuw.edu.pl [193.0.96.128]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id gA378xD00103 for ; Sun, 3 Nov 2002 08:08:59 +0100 (MET) Received: by students.mimuw.edu.pl (Postfix, from userid 2733) id 92C1F179DF; Sun, 3 Nov 2002 08:08:58 +0100 (CET) Date: Sun, 3 Nov 2002 08:08:58 +0100 From: Cezary Kaliszyk To: caml-list@inria.fr Subject: [Caml-list] format type Message-ID: <20021103070858.GB24702@zodiac.mimuw.edu.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="98e8jtXdkpgskNou" Content-Disposition: inline User-Agent: Mutt/1.3.27i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk --98e8jtXdkpgskNou Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I'm trying to write a function that takes a format and a function and applies some (got from elsewere) arguments to the function. All works ok for nonempty format. Ie:=20 myfun "%c%s" is of type: (char -> string -> unit) -> unit IS IT POSSIBLE (with the current implementation) of the format type type checking to pass some format that would require a (unit -> unit) function? Ie: I'd like: myfun "" to be of type: (unit -> unit) -> unit If such construnction is not possible at all perheapes some new identifier "%?" should be added to fromat type type checking. This argument would take exacly one argument of type unit. My current implementation: =20 let receive (fmt : (('a, unit, unit) format)) (f : 'a) : unit =3D let fmt_str =3D string_of_format fmt in let rec parse f i =3D match fmt.[i] with ... I call recursively: parse (lazified ((forced f) with applied arg)) (i + 1) ... in Obj.magic (parse (fun () -> f) 0) () ;; The only known workaround for me for now is to pass "%t" and make my function not (unit -> unit) but ('a -> unit).=20 Writing code with changed types just for the sake of the language is very bad. And with "%t" 'a seems to be (unit -> unit). Cezary Kaliszyk --=20 --98e8jtXdkpgskNou Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: Dalsze informacje znajdują się na http://www.gnupg.org/ iD8DBQE9xMuKYfPl1pqp6/URAqaZAJ4y5cie5BcPdhQIO9WcsXI1T2fw4QCaA7ro 6mXE1lKcm53r3Sj0JiTIAg4= =0d3A -----END PGP SIGNATURE----- --98e8jtXdkpgskNou-- ------------------- 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