Thanks for your answers. In fact I tried to use Simple with a clock signal and it's painful to pass it wherever you need it. Param is much more practical.<br>I like Elerea, I tried Reactive and Yampa, and I found them (especially Yampa) heavy and not very practical.<br>
The fact that Elerea is minimalistic makes it easier to learn/use and more flexible.<br><br><div class="gmail_quote">2010/12/23 Patai Gergely <span dir="ltr"><<a href="mailto:patai_gergely@fastmail.fm">patai_gergely@fastmail.fm</a>></span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">> fromList :: [a] -> SignalGen (Signal a)<br>
> fromList xs =<br>
> stateful xs tail >>= memo . fmap head<br>
><br>
> 1) It does what I want, but is it the good way to do it?<br>
</div>Yes, I'd do it the same way, assuming that the input is always an<br>
infinite list (so this version should probably be called<br>
unsafeFromList...). But you can always make a list infinite, just add a<br>
Maybe layer or pad with a default value.<br>
<div class="im"><br>
> 2) Since the returned signal may be used in several places and since I<br>
> obtain it through the generic fmap (and not through an Elerea primitive),<br>
> I guessed I had to "memo" it instead of simply using "return". Did I guess<br>
> right?<br>
</div>That's exactly what memo is needed for, yes. However, whether it is<br>
worth the overhead in such a simple case (after all, head is essentially<br>
just a single dereferencing step) should be determined by profiling.<br>
<div class="im"><br>
> 3) Concerning the functionnality added by the Param implementation, I<br>
> have<br>
> the impression that the same can be achieved through the use of an<br>
> external<br>
> signal in Simple (*). Am I right?<br>
</div>Yes, the two are equally expressive. The difference is the way you<br>
access the signals. In the case of Param, you get a globally accessible<br>
signal that you don't need to pass around explicitly, just retrieve with<br>
'input' wherever you want. This might be useful when there's some<br>
ubiquitous piece of information that you need practically everywhere,<br>
e.g. real time for a simulation.<br>
<br>
Gergely<br>
<font color="#888888"><br>
--<br>
<a href="http://www.fastmail.fm" target="_blank">http://www.fastmail.fm</a> - Does exactly what it says on the tin<br>
</font><div><div></div><div class="h5"><br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br>