Decoding a `Schema.option` using an `Option.Option` fails because the `Schema.Option` expects t...

Why does decoding a Schema.optional using an Option.Option fails?

const IdempotencyKey = Schema.UUID.pipe(Schema.brand("IdempotencyKey"), Schema.Option)
type IdempotencyKey = typeof IdempotencyKey.Type

const program = Effect.gen(function*() {
  const decodeIdempotencyKey = Schema.decode(IdempotencyKey)
  const rik = yield* decodeIdempotencyKey(Option.some("bb7d0d23-0725-4d68-b331-9061eca05b71")).pipe(
        Effect.catchTag("ParseError", (e) => Effect.log(e.message).pipe(Effect.andThen(() => Option.none())))
        // Effect.catchTag("ParseError", (e) => Option.none().pipe(Effect.tap(() => Effect.log(e.message))))
    )
  yield* Effect.log(rik)
})


https://effect.website/play#6c946204af28
Was this page helpful?