DEV Community

Mirela Prifti for Effect

Posted on • Originally published at effect.website on

Effect 3.12 (Release)

By Tim Smart

Effect 3.12 has been released! This release includes a number of new features and improvements. Here’s a summary of what’s new:

Effect.fn improvements

  • Stack traces will now include the location where the function was defined, not just where it was called.
  • A variant has been added that allows you to directly pass the function body.
  • Effect.fnUntraced has been added which allows you to create a function that is not traced, for when performance is critical.

1 import { NodeRuntime } from "@effect/platform-node"

2 import { Effect } from "effect"

3

4 const boomFunction = Effect.fn(function*(n: number) { // line 4

5   yield* Effect.annotateCurrentSpan("n", n)

6   yield* Effect.fail(new Error("boom")) // line 6

7 })

8

9 boomFunction(42).pipe( // line 9

10   Effect.catchAllCause(Effect.logError),

11   NodeRuntime.runMain

12 )

13

14 /*

15 Output:

16

17 [09:33:00.998] ERROR (#0):

18   Error: boom

19      at <anonymous (/Volumes/Code/effect/effect/scratchpad/fn.ts:6:22)

20      at <anonymous> (/Volumes/Code/effect/effect/scratchpad/fn.ts:4:29)

21      at <anonymous> (/Volumes/Code/effect/effect/scratchpad/fn.ts:9:1)

22 */

Enter fullscreen mode Exit fullscreen mode

Top comments (0)