map<R> method

Capsule<R> map<R>(
  1. R mapper(
    1. T
    )
)

Maps this Capsule (of type T) into a new idempotent Capsule (of type R) by applying the given mapper.

This is similar to .select() in some other libraries.

Implementation

Capsule<R> map<R>(R Function(T) mapper) {
  return (CapsuleReader use) => mapper(use(this));
}