MCPcopy Create free account
hub / github.com/effect-app/libs / Getter

Class Getter

repos/effect/packages/effect/src/SchemaGetter.ts:63–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61 * @category models
62 * @since 4.0.0
63 */
64export 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/**

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…