flatMap<B> method

  1. @override
ReaderTask<E, B> flatMap<B>(
  1. covariant ReaderTask<E, B> f(
    1. A a
    )
)
override

Used to chain multiple functions that return a ReaderTask.

You can extract the value inside the ReaderTask without actually running it.

Implementation

@override
ReaderTask<E, B> flatMap<B>(covariant ReaderTask<E, B> Function(A a) f) =>
    ReaderTask(
      (env) => run(env).then(
        (v) => f(v).run(env),
      ),
    );