Partial type application fixes one or more arguments of a parameterized type constructor while leaving the remaining arguments abstract. For State[S, A], fixing S produces a one-argument constructor suitable for Monad. section 11.5.2
Partially applying State
A concrete alias fixes the state type: type IntState[A] = State[Int, A]. The same idea can be written anonymously as Monad[[x] =>> State[Int, x]], or more briefly as State[Int, _] with the appropriate compiler option. Generalizing the pattern yields stateMonad[S], one monad instance for every state type. section 11.5.2
given stateMonad[S]: Monad[[x] =>> State[S, x]] with #1
def unit[A](a: => A): State[S,A] = State(s => (a, s))
extension [A](st: State[S, A])
def flatMap[B](f: A => State[S, B]): State[S, B] =
State.flatMap(st)(f)
Inspect the generic state monad instance to see the fixed S parameter and the remaining abstract result type. section 11.5.2
