From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA32122 for caml-redistribution@pauillac.inria.fr; Wed, 2 Feb 2000 23:04:15 +0100 (MET) Resent-Message-Id: <200002022204.XAA32122@pauillac.inria.fr> 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 QAA00800 for ; Wed, 2 Feb 2000 16:46:51 +0100 (MET) Received: from jaune.inria.fr (jaune.inria.fr [128.93.11.80]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id QAA11586 for ; Wed, 2 Feb 2000 16:46:50 +0100 (MET) Received: (from ddr@localhost) by jaune.inria.fr (8.8.7/8.8.7) id QAA16999; Wed, 2 Feb 2000 16:46:33 +0100 Message-ID: <20000202164632.H15054@jaune.inria.fr> Date: Wed, 2 Feb 2000 16:46:32 +0100 From: Daniel de Rauglaudre To: "Frank A. Christoph" , CAML List Subject: Re: Stream parsers, again References: <000001bf6c5a$be528a00$0150ebca@nextsolution.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2 In-Reply-To: <000001bf6c5a$be528a00$0150ebca@nextsolution.co.jp>; from Frank A. Christoph on Tue, Feb 01, 2000 at 11:19:18AM +0900 Resent-From: weis@pauillac.inria.fr Resent-Date: Wed, 2 Feb 2000 23:04:15 +0100 Resent-To: caml-redistribution@pauillac.inria.fr Hello, On Tue, Feb 01, 2000 at 11:19:18AM +0900, Frank A. Christoph wrote: > let count = parser bp [< >] -> bp This function already exists: "Stream.count". > parser [< e = p; i = count; e' = p' ? err i >] -> ... > > BTW, it is nice that the error expression is itself lazily evaluated. If you got the name of the stream (i.e. "strm"), you can also use: parser [< e = p; e' = p' ? err (Stream.count strm) >] -> ... > I think it is too restrictive that it needs to return a string > rather than an arbitrary type Mmm... Remember that polymorphic exceptions are impossible in Caml. Your solution: > exception Err of int > let err cnt = raise (Err cnt) ... is the good one. -- Daniel de RAUGLAUDRE daniel.de_rauglaudre@inria.fr http://cristal.inria.fr/~ddr/