From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id C7BBABBAF for ; Thu, 24 Sep 2009 16:19:11 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqQCAHccu0pV2gB4nGdsb2JhbACbAQEBAQEBCAsICRO7P4QbBYJL X-IronPort-AV: E=Sophos;i="4.44,445,1249250400"; d="scan'208";a="33445224" Received: from emailfrontal1.citycable.ch ([85.218.0.120]) by mail2-smtp-roc.national.inria.fr with SMTP; 24 Sep 2009 16:19:11 +0200 Received: from [192.168.0.103] (91-22.0-85.cust.bluewin.ch [85.0.22.91]) (Authenticated sender: guillaume.yziquel@citycable.ch) by emailfrontal1.citycable.ch (Postfix) with ESMTPA id D43C512C27A; Thu, 24 Sep 2009 16:19:03 +0200 (CEST) Message-ID: <4ABB7ECA.7080105@citycable.ch> Date: Thu, 24 Sep 2009 16:14:34 +0200 From: Guillaume Yziquel Reply-To: guillaume.yziquel@citycable.ch User-Agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: =?UTF-8?B?RGFuaWVsIELDvG56bGk=?= Cc: caml-list@inria.fr Subject: Re: React.E.switch issue. References: <4ABB2264.1090409@citycable.ch> <91a3da520909240642p1df60421k209e7ae16e9403ef@mail.gmail.com> In-Reply-To: <91a3da520909240642p1df60421k209e7ae16e9403ef@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; guillaume:01 guillaume:01 snippets:01 chunks:01 chunks:01 parses:01 explicitely:01 bug:01 combinators:01 invoke:01 parsed:01 parsed:01 functions:01 functions:01 parse:02 Daniel B=C3=BCnzli a =C3=A9crit : >> My issue is that the 'reinitialise_with' function is called in a >> function 'phi' which is used in the following way: >> >> let message_event =3D React.E.map phi to_be_parsed_event. >=20 > Cannot really make sense out of your snippets of code. What I want to do is the following: The server sends events with chunks of string that I want to parse. I accumulate the string chunks (with React.E.fold) until I can parse=20 some server message out of it. When some message is parsed, I discard this part of the event, and I=20 install another "accumulating event" (accumulating with React.E.fold). In order to discard and renew the "accumulating event", I send an event=20 to the event of event. This is why I use the React.E.switch construct. The output of React.E.switch is an event that can hold, for example the=20 following sequence of values: My fi My first mes My first message. My s (Here is where the event of event is renewed:) My s My secon My second mess etc... > However this phi functions seems to invoke a primitive event sending fu= nction Yes. phi is the function that parses the messages from the server. So it=20 has to send an event to renew the "accumulating event". > and that's explicitely prohibited by the documentation. Primitive event > sending/signal setting functions cannot be invoked as side effects > inside update cycles (see doc of E.create/S.create). OK. So this is not a bug, nor a feature. > Not sure what you are trying to achieve but I suspect fixed point > combinators (E.fix/S.fix) may help you to solve your problem. I tried to look into this, but I did not see how they could help me with=20 my specific issue. > Best, >=20 > Daniel For now, I'm using a workaround, but I'll try to see how I can make this=20 clean... Many thanks for your answer. --=20 Guillaume Yziquel http://yziquel.homelinux.org/