import { Effect } from "effect" export interface Post { readonly title: string readonly body: string } export const fetchPost = (id: number) => Effect.tryPromise({ try: () => fetch(`https://jsonplaceholder.typicode.com/posts/${id}`) .then(response => response.json() as Promise), catch: () => new Error("Unable to fetch post"), })