| 1 | import * as Duration from "effect/Duration" |
| 2 | import * as Effect from "effect/Effect" |
| 3 | import * as Schema from "effect/Schema" |
| 4 | import * as SchemaTransformation from "effect/SchemaTransformation" |
| 5 | |
| 6 | const schema = Schema.String.pipe(Schema.decodeTo( |
| 7 | Schema.String, |
| 8 | SchemaTransformation.transformEffect({ |
| 9 | decode: (s) => |
| 10 | Effect.gen(function*() { |
| 11 | yield* Effect.clockWith((clock) => clock.sleep(Duration.millis(300))) |
| 12 | return s |
| 13 | }), |
| 14 | encode: (_) => Effect.succeed(_) |
| 15 | }) |
| 16 | )) |
| 17 | |
| 18 | Schema.decodeUnknownEffect(schema)("a").pipe( |
| 19 | Effect.runFork |
| 20 | ) |