haskell - Is there an issue with an Event and a Behavior having the same initial value? -
there's find unsatisfying below code. develop bgamestate
, add more events. fact playerinpute
(and imagine other events
) share same initial value lead problems? in other words, initial design sound enough build off of?
also, there alternative using changes
? think meet criteria correct use, not sure.
makenetworkdescription :: addhandler playercommand -> tchan gamestate -> io eventnetwork makenetworkdescription addcommandevent gschannel = compile $ einput <- fromaddhandler addcommandevent let playerinpute = accume initialgs $ updategs <$> einput bgamestate = stepper initialgs playerinpute egamestate <- changes bgamestate reactimate $ (\n -> (atomically $ writetchan gschannel n)) <$> egamestate
i not quite understand trying do, can use accumb
combinator defined as
accumb x e = stepper x (accume x e)
to remove definition of playerinpute
.
it appears me changes
function used correctly.
Comments
Post a Comment