ap<C> method

  1. @override
HKT2<KT, A, C> ap<C>(
  1. covariant Monad2<KT, A, C Function(B a)> a
)
override

Derive ap from flatMap.

Use flatMap to extract the value from a and from the current Monad. If both these values are present, apply the function from a to the value of the current Monad, using pure to return the correct type.

Implementation

@override
HKT2<KT, A, C> ap<C>(covariant Monad2<KT, A, C Function(B a)> a) =>
    a.flatMap((f) => flatMap((v) => pure(f(v))));