▸case-22 I have a pipeline receiving `Either<string, string>` containing raw numerical strings. I want to parse the string to an integer with `Number()`, then multiply it by 10, staying within fp-ts Either. Which mapping method is used to transform the Right value sequentially? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-14 I am building a multi-step data validator in TypeScript using fp-ts where step 1 validates an ID format and step 2 checks database permissions. Each step returns an `Either<string, Data>`. I want the validation sequence to short-circuit immediately on the first failure. How should these steps be combined? | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-03 I am fetching a user object from a dictionary that might return undefined or null in TypeScript. If the value is missing, I want to return a Left with the string 'User not found'. Rather than writing an explicit ternary check, which fp-ts/Either helper converts a nullable value into an Either using a curried error factory? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-19 I have an `Either<string, User>` and a fallback generator function `getDefaultUser()`. How do I safely unwrap the `User` object using fp-ts `getOrElse` so that if the Either is a `Left`, the fallback function is executed to provide the default? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-26 I need to encapsulate reading from DOM local storage or writing to stdout in TypeScript using fp-ts as a synchronous side effect that never fails. Which fp-ts abstraction is designed for non-failing synchronous side effects? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-11 I have an `Either<Error, Customer>` in TypeScript. For compatibility with a non-fp-ts library function expecting `Error | Customer`, I want to convert the Either into a plain TypeScript union type. Which helper converts an Either directly to `E | A`? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-13 How do I write a reusable helper function `safeParseJson(jsonString: string)` in TypeScript with fp-ts that converts `JSON.parse` exceptions into a `Left<string>` containing `'Parse error: ...'` and successful parsing into a `Right<unknown>`? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-07 Suppose I have an initial `Either<string, string>` containing a raw auth token. I want to pass this token into `decodeToken(token: string): Either<string, User>`, which itself returns an Either. If I use `E.map`, I end up with a nested `Either<string, Either<string, User>>`. Which fp-ts function flattens and chains this computation? | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-02 In a TypeScript application using fp-ts/Either, I need to wrap a string value 'ok' into a successful result and an Error('fail') into an error result. What are the specific fp-ts constructor functions to create these two states? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-10 I need to render an fp-ts `Either<string, User>` to the UI console. If it is a Left error, I want to execute `logError(err)`. If it is a Right user, I want to execute `renderUser(user)`. Which fp-ts function performs exhaustive pattern matching across both branches? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-01 I need to validate a user profile object in TypeScript using fp-ts. Specifically, check that the username is non-empty and the age requirement is met, returning either the valid object or a descriptive error message on failure. Please provide a functional pipeline example. | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-15 In a TypeScript backend service, my teammate wants to know when to prefer fp-ts Either over standard synchronous try/catch blocks. What key benefit does Either provide regarding type safety and error explicit language in function signatures? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-08 I have an `Either<string, number>` representing a numeric score. I want to inspect the numeric score and convert it into a Left('Score too low') if the number is less than 50, otherwise keeping it as a Right. Which fp-ts operator tests a Right value against a predicate and converts it to a Left on failure? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-16 An external TypeScript module returns `string | null` from a cache lookup `getCache(key)`. I want to convert this response into an `Either<string, string>` where `null` becomes `Left('Cache miss')`. How should I invoke fp-ts to handle this conversion compactly? | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-05 Given an `Either<string, number>` in fp-ts representing a user's score, I want to double the score if the operation succeeded, while leaving any failure error message completely untouched. Which mapping operation should I call? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-18 In my fp-ts pipeline, an upstream validation step produces `Either<number, Config>` where the error is an HTTP status code integer like 404. I need to transform this status code into a formatted string `'HTTP Error code: ' + code` before passing it to the error logger. Which fp-ts method should I insert into the pipe? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-24 I am writing a TypeScript function to fetch user preferences from a REST endpoint asynchronously. On network failure or non-200 HTTP status, I need to capture the error in a typed container rather than throwing. How should I represent and chain this asynchronous operation using fp-ts? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-09 I hold an `Either<string, number>` value in TypeScript using fp-ts. I need to extract the underlying number to pass into a legacy API that accepts only `number`. If the value is a Left, I want to fallback to a default value of `0`. Which function extracts the value or returns the default? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-12 I have imperative code in TypeScript:
```typescript
function processInput(rawText: string) {
try {
const parsed = JSON.parse(rawText);
return handleSuccess(parsed);
} catch (err) {
return handleFailure(err);
}
}
```
How can I rewrite this processing flow into an fp-ts functional pipeline using Either? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-17 I need to take a raw string input, parse it as JSON, extract a numeric field `age`, and verify that `age >= 18`, returning an `Either<string, User>` in fp-ts. How should `pipe`, `E.tryCatch`, `E.map`, and `E.filterOrElse` be composed to build this pipeline? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-04 I have a legacy synchronous function `parseConfig(path: string): Config` in TypeScript that throws an Exception on disk or syntax errors. I want to convert calls to this function into an fp-ts Either without writing manual try/catch blocks. Which function should I use and how is the error handler passed? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-25 In TypeScript with fp-ts, I have an optional user configuration setting where missing values default to system defaults without returning error details or failure codes. Which fp-ts data structure represents missing values when error details are irrelevant? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-06 I have an `Either<Error, User>` outcome in fp-ts. I need to transform the internal Left error into a user-friendly string message `Error: ${err.message}` while leaving any successful User payload unchanged. Which fp-ts function performs this left-side transformation? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-20 I have an `Either<string, string>` where both the Left error and Right success are strings. I want to extract the string regardless of whether it succeeded or failed, passing successful values through unchanged and handling error strings with a console log. Which function performs this pattern match using `identity` or custom handlers? | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-21 In fp-ts, how is the Either type defined conceptually in terms of generics and standard TypeScript tagged unions? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
▸case-23 When unwrapping an `Either<string, Config>` in fp-ts without throwing exceptions, which function allows providing a fallback function that receives the error and returns a default `Config`? | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |