State Monad in TypeScript
I'm probably off my rocker here, but what if rather than nested chains of bind, you used a fork/join type of approach?

static combine&lt;T, S, R&gt;(
    monads: { [P in keyof T]: StateMonad&lt;S, T[P]&gt; },
    selector: (values: T) =&gt; R
)
    : StateMonad&lt;S, R&gt; {
    return new StateMonad&lt;S, R&gt;((state) =&gt; {
    var ret: any = {};
    for (const key in monads) {
        if (monads.hasOwnProperty(key)) {
        ret[key] = monads[key].runState(state).a;
        }
    }
    return { a: selector(ret), s: state }
    }
    );
}


and

var { a } = StateMonad
  .combine(
    {
      countLowerCase,
      countDigits
    },
    combined =&gt;
      combined.countLowerCase +
      combined.countDigits
  )
  .runState("abc123ABC");