
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
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@haskell.org http://www.haskell.org/mailman/listinfo/reactive