DEV Community

Mirela Prifti for Effect

Posted on • Originally published at effect.website on

Effect 3.13 (Release)

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

Schema.standardSchemaV1

This API allows you to generate a Standard Schema v1 object from an Effect Schema.


1

import { Schema } from "effect"

2

3

const schema = Schema.Struct({

4

  name: Schema.String

5
})

6

7
// ┌─── StandardSchemaV1<{ readonly name: string; }>

8
// ▼

9

const standardSchema = Schema.standardSchemaV1(schema)

Enter fullscreen mode Exit fullscreen mode

Effect.fn improvements

Effect.fn has been improved to allow you to access the function arguments inside any of the pipeline functions.


1

import { Effect } from "effect"

2

3

const fn = Effect.fn("my function")(

4

  function* (n: number) {

5

    yield* Effect.log(`n is ${n}`)

6

  },

7

  // you can now access the arguments here

8

  (effect, n) => Effect.annotateLogs(effect, { n })

9
)

Enter fullscreen mode Exit fullscreen mode

RcMap improvements

  • RcMap.invalidate has been added, for invalidating a resource at the given key.
  • RcMap.touch has been added, for refreshing the idle timeout of a resource at the given key.

1

import { Effect, RcMap } from "effect"

2

3

Effect.gen(function* () {

4

  const map = yield* RcMap.make({

5

    lookup: (n: number) => Effect.succeed(n),

6

    idleTimeToLive: "1 minute"

7

  })

8

9

  // retrieve the resource at key 1

10

  yield* Effect.scoped(RcMap.get(map, 1))

11

12

  // refresh the idle timeout of the resource at key 1

13

  yield* RcMap.touch(map, 1)

14

15

  // invalidate the resource at key 1

16

  yield* RcMap.invalidate(map, 1)

17
})

Enter fullscreen mode Exit fullscreen mode

Effect.transposeOption

This function transforms an Option<Effect<A, E, R>> into anEffect<Option<A>, E, R>. If the Option is None, the resulting Effectwill immediately succeed with a None value. If the Option is Some, the inner Effect will be executed, and its result wrapped in a Some.


1

import { Effect, Option } from "effect"

2

3
// ┌─── Option<Effect<number, never, never>>

4
// ▼

5

const maybe = Option.some(Effect.succeed(42))

6

7
// ┌─── Effect<Option<number>, never, never>

8
// ▼

9

const result = Effect.transposeOption(maybe)

10

11

console.log(Effect.runSync(result))

12
// Output: { _id: 'Option', _tag: 'Some', value: 42 }

Enter fullscreen mode Exit fullscreen mode

Hot sauce if you're wrong - web dev trivia for staff engineers

Hot sauce if you're wrong · web dev trivia for staff engineers (Chris vs Jeremy, Leet Heat S1.E4)

  • Shipping Fast: Test your knowledge of deployment strategies and techniques
  • Authentication: Prove you know your OAuth from your JWT
  • CSS: Demonstrate your styling expertise under pressure
  • Acronyms: Decode the alphabet soup of web development
  • Accessibility: Show your commitment to building for everyone

Contestants must answer rapid-fire questions across the full stack of modern web development. Get it right, earn points. Get it wrong? The spice level goes up!

Watch Video 🌶️🔥

Top comments (0)

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, cherished by the supportive DEV Community. Coders of every background are encouraged to bring their perspectives and bolster our collective wisdom.

A sincere “thank you” often brightens someone’s day—share yours in the comments below!

On DEV, the act of sharing knowledge eases our journey and forges stronger community ties. Found value in this? A quick thank-you to the author can make a world of difference.

Okay