| 61 | * @category models |
| 62 | * @since 4.0.0 |
| 63 | */ |
| 64 | export class Getter<out T, in E, R = never> extends Pipeable.Class { |
| 65 | readonly run: ( |
| 66 | input: Option.Option<E>, |
| 67 | options: SchemaAST.ParseOptions |
| 68 | ) => Effect.Effect<Option.Option<T>, SchemaIssue.Issue, R> |
| 69 | |
| 70 | constructor( |
| 71 | run: ( |
| 72 | input: Option.Option<E>, |
| 73 | options: SchemaAST.ParseOptions |
| 74 | ) => Effect.Effect<Option.Option<T>, SchemaIssue.Issue, R> |
| 75 | ) { |
| 76 | super() |
| 77 | this.run = run |
| 78 | } |
| 79 | map<T2>(f: (t: T) => T2): Getter<T2, E, R> { |
| 80 | return new Getter((oe, options) => this.run(oe, options).pipe(Effect.mapEager(Option.map(f)))) |
| 81 | } |
| 82 | compose<T2, R2>(other: Getter<T2, T, R2>): Getter<T2, E, R | R2> { |
| 83 | if (isPassthrough(this)) { |
| 84 | return other as any |
| 85 | } |
| 86 | if (isPassthrough(other)) { |
| 87 | return this as any |
| 88 | } |
| 89 | return new Getter((oe, options) => this.run(oe, options).pipe(Effect.flatMapEager((ot) => other.run(ot, options)))) |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | /** |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…