| 1 | import * as Effect from "effect/Effect" |
| 2 | import * as FetchHttpClient from "effect/http/FetchHttpClient" |
| 3 | import * as HttpClient from "effect/http/HttpClient" |
| 4 | |
| 5 | Effect.gen(function*() { |
| 6 | const client = yield* HttpClient.HttpClient |
| 7 | const res = yield* client.get("https://jsonplaceholder.typicode.com/posts/1") |
| 8 | yield* res.json |
| 9 | }).pipe( |
| 10 | Effect.provide(FetchHttpClient.layer), |
| 11 | Effect.runPromise |
| 12 | ) |