ateFlowBalance ::
  (Arith.Sum a, UV.Unbox a, Arith.Sum (sweep vec a)) =>
  EnvResult node (sweep vec a) ->
  Map node (Result (sweep vec a))
stateFlowBalance = fmap (f . Storage.nodes) . StateQty.storages
  where f pm = liftA2 (~-) (PartMap.exit pm) (PartMap.init pm)


stateFlowBalance ::
  (Arith.Sum a, UV.Unbox a, Arith.Sum (sweep vec a)) =>
  EnvResult node (sweep vec a) ->
  Map node (Result (sweep vec a))
stateFlowBalance = fmap (f . Storage.nodes) . StateQty.storages
  where f pm = liftA2 (~-) (PartMap.exit pm) (PartMap.init pm)
stateFlowBalance = fmap (f . Storage.nodes) . StateQty.storages
  where f pm = liftA2 (~-) (PartMap.exit pm) (PartMap.init pm)