plainfp - v0.1.0
    Preparing search index...

    Function flatMap

    • Chain a Result-producing step. If the input is err, fn is skipped; otherwise fn runs and its result (possibly another err) becomes the output. Error channels are unioned.

      Dual API — works data-first or curried for use in pipe.

      Type Parameters

      • T
      • E
      • U
      • F

      Parameters

      Returns ResultType<U, E | F>

      pipe(
      parseOrderId(raw),
      Result.flatMap(id => loadOrder(id)),
      Result.flatMap(order => chargePayment(order)),
      )
    • Chain a Result-producing step. If the input is err, fn is skipped; otherwise fn runs and its result (possibly another err) becomes the output. Error channels are unioned.

      Dual API — works data-first or curried for use in pipe.

      Type Parameters

      • T
      • U
      • F

      Parameters

      Returns <E>(result: ResultType<T, E>) => ResultType<U, F | E>

      pipe(
      parseOrderId(raw),
      Result.flatMap(id => loadOrder(id)),
      Result.flatMap(order => chargePayment(order)),
      )