Hyperlinkv0.8.0-beta.28

Exit

Exit.mapconsteffect/Exit.ts:830
<A, B>(f: (a: A) => B): <E>(self: Exit<A, E>) => Exit<B, E>
<A, E, B>(self: Exit<A, E>, f: (a: A) => B): Exit<B, E>

Transforms the success value of an Exit using the given function.

When to use

Use to apply a transformation to the value inside a successful Exit

Details

Failures pass through unchanged.

Allocates a new Exit if successful.

Example (Mapping over a success)

import { Exit } from "effect"

const exit = Exit.succeed(21)
const doubled = Exit.map(exit, (x) => x * 2)
console.log(Exit.isSuccess(doubled) && doubled.value) // 42
combinatorsmapErrormapBoth
Source effect/Exit.ts:8304 lines
export const map: {
  <A, B>(f: (a: A) => B): <E>(self: Exit<A, E>) => Exit<B, E>
  <A, E, B>(self: Exit<A, E>, f: (a: A) => B): Exit<B, E>
} = effect.exitMap
Referenced by 1 symbols