[Haskell-cafe] Infinite lists in real world programs

Yves Parès limestrael at gmail.com
Wed Dec 22 22:56:40 CET 2010


Patai, I read your paper on Elerea. It wasn't easy :), but I think I got the
picture.
So I would have 2 questions :

I made a simple function which turns an infinite list into a signal :

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?
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?

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? If so, why did you make the Param
alternative?

(*) (ext, sink) <- external 'a'
    driver <- start $ someSigGen ext
    sink 'b'
    driver
    sink 'c'
    driver
    sink 'd'
    driver
etc...


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

> > So in the result of (a >>= f), the first element is taken from the
> > first element of applying f to the first element of a; the second
> > element is the second element in the result of applying f to the second
> > element of a; and so on.  Off the top of my head I am not sure what
> > this corresponds to in terms of agents or where it would be useful,
> > but I'm sure it must correspond to something interesting.
> In short, join corresponds to continuously sampling a stream of streams.
> In other words, it turns a higher-order stream into a dynamic data-flow
> network. That's exactly what the Elerea library [1] is good for: it
> allows you to do this in constant time instead of the quadratic cost of
> the pure implementation, but it forces you to traverse streams
> sequentially -- fortunately, that's exactly what you want to do most of
> the time. There is also a paper behind the library, which might help a
> bit in getting a clearer picture [2] (the paper also has an updated
> version in the process of being published).
>
> Gergely
>
> [1] http://hackage.haskell.org/package/elerea
> [2]
> http://sgate.emt.bme.hu/documents/patai/publications/PataiWFLP2010.pdf
>
> --
> http://www.fastmail.fm - One of many happy users:
>  http://www.fastmail.fm/docs/quotes.html
>
>
> _______________________________________________
> 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/20101222/018013ef/attachment.htm>


More information about the Haskell-Cafe mailing list