contramap<A> method

bool Function(A) contramap<A>(
  1. P map(
    1. A a
    )
)

Apply map to the value of the parameter P and return a new bool Function(A).

Similar to map for functions that return bool.

bool even(int n) => n % 2 == 0;
final evenLength = even.contramap<String>((a) => a.length);

Implementation

bool Function(A) contramap<A>(P Function(A a) map) => (a) => this(map(a));