[reactive] First draft of reactive-tetris

Conal Elliott conal at conal.net
Tue Nov 18 13:11:53 EST 2008


Cool!  Thanks to quicksilver for the insight on and elegant definition of
subs.

How about one of the following terser variations on the randomEvent def:

    randomEvent std e = subs (randoms g) e

    randomEvent std = subs (randoms g)

    randomEvent = subs . randoms


  - Conal

2008/11/18 Creighton Hogg <wchogg at gmail.com>

>
> Being a dirty schlub & replying to myself, it turns out there is a way to
> substitute an infinite list into an Event as we've talked about this on
> #haskell this morning.
>
> subs xs e :: [a] -> Event b -> Event a
> subs xs e = head <$> accumE xs (tail <$ e)
>
> so then we can very easily do
>
> randomEvent :: (RandomGen g,Random b) => g -> Event a -> Event b
> randomEvent std e = let vals = randoms g in subs vals e
>
> Cool!
> Now I just need to change my Tetris to do that instead of messing with a
> Behavior.
>
>
>
>
> _______________________________________________
> Reactive mailing list
> Reactive at haskell.org
> http://www.haskell.org/mailman/listinfo/reactive
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/reactive/attachments/20081118/e4227138/attachment.htm


More information about the Reactive mailing list