caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>
To: "Frank A. Christoph" <christo@nextsolution.co.jp>,
	CAML List <caml-list@inria.fr>
Subject: Re: Stream parsers, again
Date: Wed, 2 Feb 2000 16:46:32 +0100	[thread overview]
Message-ID: <20000202164632.H15054@jaune.inria.fr> (raw)
In-Reply-To: <000001bf6c5a$be528a00$0150ebca@nextsolution.co.jp>; from Frank A. Christoph on Tue, Feb 01, 2000 at 11:19:18AM +0900

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/



      reply	other threads:[~2000-02-02 22:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-01  2:19 Frank A. Christoph
2000-02-02 15:46 ` Daniel de Rauglaudre [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20000202164632.H15054@jaune.inria.fr \
    --to=daniel.de_rauglaudre@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=christo@nextsolution.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).