[Haskell-cafe] Improving event management in elerea

jean legrand kkwweett at yahoo.fr
Thu Aug 13 11:20:40 EDT 2009

> http://hpaste.org:80/fastcgi/hpaste.fcgi/view?id=8159
> and I have two questions.
> 1) my event function (line 79) returns a new signal and
> takes 3 arguments : an initial signal and a Bool signal
> which triggers when to apply the transform function given as
> a third argument. The body of the event function uses two
> calls to the sampler function. Is it possible to write this
> body with a unique call to sampler ?

Second question solved with

event ini b f = mdo
  let gs = generator eb $ (flat.f) <$> s'
  eb <- edge b
  s' <- sampler <$> storeJust ini gs
  s <-  sampler <$> storeJust s' gs
  return s

but I still can't answer my first one (couldn't this function -or its improvement- be part of the library ?)


More information about the Haskell-Cafe mailing list