[Haskell-cafe] Infinite lists in real world programs

Yves Parès limestrael at gmail.com
Thu Dec 23 23:42:50 CET 2010

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
I like Elerea, I tried Reactive and Yampa, and I found them (especially
Yampa) heavy and not very practical.
The fact that Elerea is minimalistic makes it easier to learn/use and more

2010/12/23 Patai Gergely <patai_gergely at fastmail.fm>

> > fromList :: [a] -> SignalGen (Signal a)
> > fromList xs =
> >   stateful xs tail >>= memo . fmap head
> >
> > 1) It does what I want, but is it the good way to do it?
> Yes, I'd do it the same way, assuming that the input is always an
> infinite list (so this version should probably be called
> unsafeFromList...). But you can always make a list infinite, just add a
> Maybe layer or pad with a default value.
> > 2) Since the returned signal may be used in several places and since I
> > obtain it through the generic fmap (and not through an Elerea primitive),
> > I guessed I had to "memo" it instead of simply using "return". Did I
> guess
> > right?
> That's exactly what memo is needed for, yes. However, whether it is
> worth the overhead in such a simple case (after all, head is essentially
> just a single dereferencing step) should be determined by profiling.
> > 3) Concerning the functionnality added by the Param implementation, I
> > have
> > the impression that the same can be achieved through the use of an
> > external
> > signal in Simple (*). Am I right?
> Yes, the two are equally expressive. The difference is the way you
> access the signals. In the case of Param, you get a globally accessible
> signal that you don't need to pass around explicitly, just retrieve with
> 'input' wherever you want. This might be useful when there's some
> ubiquitous piece of information that you need practically everywhere,
> e.g. real time for a simulation.
> Gergely
> --
> http://www.fastmail.fm - Does exactly what it says on the tin
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20101223/0a8641e7/attachment.htm>

More information about the Haskell-Cafe mailing list