These

Inclusive-or: represent "this", "that", or "both"

What is These?

These represents three possible states: Left (error), Right (success), or Both (success with warnings). More powerful than Either when you need to return both a result and warnings or metadata. Perfect for validation with warnings.

// Either can't represent warnings:
return hasWarnings ? E.left(warnings) : E.right(data)

// These can handle both:
return TH.both(warnings, data)
fold
map/bimap
Semigroup
validation with warnings
3️⃣

Three States

Left, Right, or Both at once

⚠️

Warnings

Return success with warnings

📋

Accumulation

Collect errors while succeeding

💪

Flexible

More powerful than Either

These in Action

❌ Multiple Return Types

function process(data: Data): Result | Error | Both {
  // Complex logic to handle 3 cases
  // Type safety is difficult
}

// Awkward to work with

✅ These Approach

function process(data: Data): These<Error[], Result> {
  return hasWarnings
    ? TH.both(warnings, result)
    : TH.right(result)
}

// Success with warnings supported

Practice Exercises

1

Basic

Learn about basic in fp-ts these

beginnerStart
2

Fold

Learn about fold in fp-ts these

beginnerStart
3

Map

Learn about map in fp-ts these

beginnerStart
4

From Options

Learn about from options in fp-ts these

intermediateStart
5

Semigroup

Learn about semigroup in fp-ts these

intermediateStart
6

Practical

Learn about practical in fp-ts these

intermediateStart

Why Learn These?

⚖️

Master These

Learn the fundamental concepts and patterns that make These powerful

💪

6 Exercises

Practice with hands-on exercises from advanced level

🚀

Production Ready

Apply These patterns to build robust, type-safe applications