From: Guillaume Yziquel <guillaume.yziquel@citycable.ch>
To: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
Cc: caml-list@inria.fr
Subject: Re: React.E.switch issue.
Date: Thu, 24 Sep 2009 10:01:23 +0200 [thread overview]
Message-ID: <4ABB2753.3090303@citycable.ch> (raw)
In-Reply-To: <4ABB2264.1090409@citycable.ch>
Guillaume Yziquel a écrit :
> Hello.
Hi again.
> Here is a piece of code that I am having issue. I'm trying to use React
> to parse reactively a server output. I have the following event definition:
>
>> let event_starting_at str = React.E.fold begin fun accu chunk ->
>> accu^chunk end str received_event in let
>> to_be_parsed_event_of_event, set_to_be_parsed_event_of_event =
>> React.E.create () in
>> let to_be_parsed_event = React.E.switch (event_starting_at "")
>> to_be_parsed_event_of_event in
>> let reinitialise_with unparsed_text =
>> set_to_be_parsed_event_of_event (event_starting_at unparsed_text) in
I've replaced the previous code by the following piece of code, and it
now works...
> let event_starting_at ?drop:(drop = false) str = React.E.fold begin fun accu chunk -> accu^chunk end str
> begin match drop with | false -> received_event | true -> React.E.drop_once received_event end in
> let to_be_parsed_event_of_event, set_to_be_parsed_event_of_event = React.E.create () in
> let to_be_parsed_event = React.E.switch (event_starting_at "") to_be_parsed_event_of_event in
> let reinitialise_with unparsed_text = set_to_be_parsed_event_of_event
> (event_starting_at ~drop: true unparsed_text) in
Now, is this a bug or a feature?
All the best,
Guillaume Yziquel.
--
Guillaume Yziquel
http://yziquel.homelinux.org/
next prev parent reply other threads:[~2009-09-24 8:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-24 7:40 Guillaume Yziquel
2009-09-24 8:01 ` Guillaume Yziquel [this message]
2009-09-24 13:42 ` Daniel Bünzli
2009-09-24 14:14 ` Guillaume Yziquel
2009-09-28 11:57 ` Daniel Bünzli
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=4ABB2753.3090303@citycable.ch \
--to=guillaume.yziquel@citycable.ch \
--cc=caml-list@inria.fr \
--cc=daniel.buenzli@erratique.ch \
/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).