▸case-02 Our service currently fetches user profiles from a remote API and falls back to a database query using nested try/catch blocks in TypeScript. Could you help refactor this asynchronous sequence into a functional programming pipeline where network failures and missing records are represented explicitly in the return type without throwing errors, and demonstrate how to handle falling back to alternative data sources seamlessly? | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-23 We are writing plain TypeScript functions without any external functional programming libraries. We want to define a custom type `type Result<T, E> = { success: true; value: T } | { success: false; error: E }` using TypeScript discriminated unions and narrowing. How do we write a function returning this custom union type? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-16 We have a function returning `Either<string, number>`. We want to increment the number if successful, but if it failed with a string message, prefix the message with 'Validation Error: '. What functional operators should be applied to transform both sides? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-14 When executing an HTTP request with `fetch`, non-2xx status codes (like 404 or 500) do not reject the promise. We want a functional wrapper around `fetch` that checks `response.ok`, parsing JSON if true, or failing with a structured `{ code, message, status }` object if false or if network fails. How should this pipeline be constructed? | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-11 We have a functional pipeline returning a `TaskEither<Error, User>`, but we need to supply this to a legacy framework route handler that expects a standard `Promise<User>` and expects exceptions to be thrown on failure. How do we execute the task and convert a Left error into a rejected promise? | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-08 We need to load three independent user data endpoints (posts, notifications, settings) concurrently in TypeScript after retrieving the user profile. Instead of awaiting `Promise.all` and risking unhandled rejections, how do we combine these three asynchronous functional tasks in parallel into a single task that returns a struct of all three results? | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-13 We receive an unknown JSON payload `raw: unknown` from an HTTP request body in TypeScript. We want to validate that it is an object, that `id` is a number, and that `name` is a non-empty string, returning an Either with a descriptive string on the first invalid field. How can Do-notation be structured for this step-by-step object parsing? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-05 In a TypeScript service, we have two sequential steps: `validateId` returning a `ValidationError` and `fetchUser` returning a `DbError`. If we chain them using standard monadic bind, TypeScript flags a type mismatch on the left side because the error types differ. How do we compose these two steps so the resulting return type automatically becomes a union of `ValidationError | DbError`? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-07 We have an Either representing a successfully fetched user record, but we must verify that `user.isActive` is true before proceeding. If false, we want the pipeline to transition to a Left containing 'User not active'. Which functional operator filters a Right value against a predicate and converts it to Left if predicate fails? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-20 When fetching user profile data from a cache service, if the cache fetch fails (returns Left), we want to fall back to fetching from a database, and if that also fails, fall back to a default guest profile Right value. Which asynchronous result operator allows chaining these fallback alternatives? | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-15 We have an array of user IDs to delete from a database asynchronously. We want to execute all deletion tasks regardless of individual failures, and collect a summary report containing `{ succeeded: User[], failed: Array<{ id: string, error: string }> }`. How can this bulk operation be written using functional array and task primitives? | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-09 When calling a remote microservice that intermittently fails with 503 status, we want an async functional workflow that automatically retries the operation up to 3 attempts with exponential delay backoff before returning the final error. How can this retry wrapper be implemented functionally? | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-18 In a TypeScript configuration reader that returns `Either<ConfigError, AppConfig>`, we want to extract the inner `AppConfig` object, but fall back to a predefined `defaultConfig` object if the reader returned Left. Which operator extracts the value with a fallback function? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-04 In a TypeScript Node.js backend handling JSON payloads, we have a function calling `JSON.parse` which throws SyntaxError when invalid string data arrives. We want to convert this throwing behavior into a functional result type that wraps errors into an Error object rather than letting exceptions propagate. How should this conversion function be implemented using functional patterns? | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-19 At the edge of our application (an HTTP controller), we have an `Either<DomainError, ResponseData>`. We need to map this result to an HTTP response, turning Left into a 400 JSON error response and Right into a 200 JSON success response. Which operator handles both branches to produce a single return value? | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-10 We are integrating a third-party SDK method that returns a `Promise<UserData>` and throws an exception on network failure. We want to wrap this SDK call into a lazy asynchronous functional effect that returns an Error on failure. What constructor should be used to lift this Promise into the functional pipeline? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-12 For a web form with multiple inputs, returning plain error strings makes it difficult for UI components to highlight specific invalid inputs. We want to structure each accumulated error as an object with `{ field: string, message: string }`. How can we configure error accumulation so that validation functions attach field names to each error? | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-03 I need to process a list of raw string inputs in TypeScript where individual items might fail to parse. Rather than failing the entire batch or using a try/catch loop, I want a functional utility that runs the parsing logic over the array and yields a structured report separating successful outputs from failed inputs along with their error details. How can I implement this pattern using functional error handling? | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-22 In a modern Effect (Effect-TS) backend application, we want to construct a program using `Effect.gen` and `Effect.fail` / `Effect.succeed` to handle error propagation natively using Effect fibers and generators. How do we write a basic Effect generator workflow for user fetching? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-01 I have a user registration form with email, password, and age fields in my TypeScript backend. I want to validate all three fields together and accumulate every failing rule into a single list instead of stopping at the first error, using functional programming constructs rather than throwing exceptions. Please show me how to write this validation suite and aggregate the field-level issues into a clean structured result. | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-06 When processing an order in TypeScript, we need to fetch a user and then fetch a product using the user's account details. Standard monadic chaining results in deeply nested callbacks to access both `user` and `product` at the final `createOrder` step. What functional pattern allows binding intermediate values flatly into a context object before creating the order? | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-17 We have an `Option<User>` returned from a lookup function, but downstream services require an `Either<string, User>` with the error string 'User not found' when the option is None. What function converts an Option to an Either with a provided fallback error? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-21 We are building a TypeScript service using Zod for runtime schema validation. We define a schema `z.object({ name: z.string(), age: z.number().min(18) })` and want to parse input data while capturing detailed Zod validation issues using standard Zod methods. How should we perform safe parsing with Zod natively? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |