| 465 | * @since 4.0.0 |
| 466 | */ |
| 467 | export function checkEffect<T, R = never>( |
| 468 | f: (input: T, options: SchemaAST.ParseOptions) => Effect.Effect< |
| 469 | undefined | boolean | Schema.FilterIssue, |
| 470 | never, |
| 471 | R |
| 472 | > |
| 473 | ): Getter<T, T, R> { |
| 474 | return onSome((t, options) => { |
| 475 | return f(t, options).pipe(Effect.flatMapEager((out) => { |
| 476 | const issue = SchemaIssue.makeSingle(out, t, options) |
| 477 | return issue ? |
| 478 | Effect.fail(issue) : |
| 479 | Effect.succeed(Option.some(t)) |
| 480 | })) |
| 481 | }) |
| 482 | } |
| 483 | |
| 484 | /** |
| 485 | * Creates a getter that applies a pure function to present values. |