Help me rewrite these nested reductions?

It also supports reduce, to allow wiring the socket state through.