Three days later, and its solution: in fact, it was not connected with either the network or the concurrency code, but with inflation caused by the incorrect re-implementation of Yampas dpSwitch in Netwire. The corrected code is listed below for everyone who wants to implement this function:
dpSwitch :: (Monoid e, Applicative m, Monad m, T.Traversable col) => (forall wire. a -> col wire -> col (b, wire)) -> col (Wire sembc) -> Wire sem (a, col c) (Event d) -> (col (Wire sembc) -> d -> Wire sema (col c)) -> Wire sema (col c) dpSwitch route wireCol switchEvtGen continuation = WGen $ gen wireCol switchEvtGen where gen wires switchEvtGenWire _ (Left x) = return (Left mempty, WGen $ gen wires switchEvtGenWire) gen wires switchEvtGenWire ws (Right x) = do let routings = route x wires wireSteps <- T.sequenceA (fmap (\(wireInput, wire) -> stepWire wire ws (Right wireInput)) routings) let wireOutputs = T.sequenceA (fmap fst wireSteps) steppedWires = fmap snd wireSteps case wireOutputs of Left wireInhibitedOutput -> return (Left wireInhibitedOutput, WGen $ gen steppedWires switchEvtGenWire) Right wireResultOutput -> do (event, steppedSwitchEvtGenWire) <- stepWire switchEvtGenWire ws (Right (x, wireResultOutput)) case event of Left eventInhibited -> return (Left eventInhibited, WGen $ gen steppedWires steppedSwitchEvtGenWire) Right NoEvent -> return (wireOutputs, WGen $ gen steppedWires steppedSwitchEvtGenWire) Right (Event e) -> return (wireOutputs, continuation steppedWires e)
Mattiemus
source share