I can only guess why netwire does not provide this. Everything in Control.Wire.Eventstores results in Event, retaining knowledge of when they occur.
You can exit Eventusing one of the switching methods Control.Wire.Switch. You are looking for rSwitch.
-- Beware: untested, untype-checked code
stepper :: (Monad m) => a -> Wire s e m (Event a) a
stepper init = switcher . source
where
-- source :: Wire s e m (Event a) ((), Event (Wire s e m () a))
source = arr (\e -> ((), pure <$> e))
-- switcher :: Wire s e m ((), Event (Wire s e m () a)) a
switcher = rSwitch (pure init)
The above code is pureused both a -> Wire s e m () ato create trivial wires.
source
share