# The Third Slot of Effect (Learning Effect, Part 7)

- Published: 2026-07-16
- Updated: 2026-10-21
- Tags: Learning Effect, Effect, TypeScript
- URL: https://devtrillo.com/writing/learning-effect-7-the-third-slot/

The first two slots are easier to care about.

```ts
Effect.Effect<Success, Error, Requirements>;
```

Success is what I want.

Error is what can go wrong.

The third slot is quieter.

It says what the program needs.

## The plain version

```ts
import { db } from "./db";

const fetchUser = async (id: number): Promise<User> => {
  return db.users.findById(id);
};
```

The type is `(id: number) => Promise<User>`.

It does not mention `db`.

The dependency is real. It is not in the type.

To test this, you mock the module or point it at a real database.

The type gives you no hint either way.

In a big app, that is the hint you want most.

Which functions talk to the database? Today you search the imports to find out.

## `never` means nothing is needed

```ts
Effect.Effect<number, InvalidUserId, never>;
```

This can parse a number and fail with `InvalidUserId`.

It does not need a database, config, logger, or HTTP client.

So the requirement is `never`.

**Quiz:** What does never mean in the third slot?

- No external service is required
- The program cannot succeed
- The program cannot fail

**Answer:** No external service is required — The third slot is the environment. never means there is nothing to provide.

## A real dependency shows up there

```ts
interface UserRepo {
  readonly findById: (id: number) => Effect.Effect<User, UserNotFound>;
}
```

A program that needs `UserRepo` has that in the type:

```ts
Effect.Effect<User, UserNotFound, UserRepo>;
```

Read it as:

> I can give you a User, I may fail with UserNotFound, and I need a UserRepo.

**Quiz:** In Effect.Effect<User, UserNotFound, UserRepo>, what must be provided before running?

- User
- UserNotFound
- UserRepo

**Answer:** UserRepo — The third slot lists the required service. This program needs a UserRepo.

## Why this matters

In normal code, dependencies hide in imports.

A function calls a module. The module reads config. The config reads env vars. Somewhere in there, the test gets annoying.

Effect makes the need visible.

That does not magically make the design good.

But it makes the hidden part harder to ignore.

## The mistake: running before you provide

The third slot is a checklist for the edge.

```ts
const program = fetchUser(1);
// Effect.Effect<User, UserNotFound, UserRepo>

Effect.runPromise(program);
```

This does not compile.

The error says `UserRepo` is not assignable to `never`.

That message reads strange the first time.

It means the runner wants an empty third slot. This program still needs something.

How to spot it: a type error that mentions `never` next to one of your service names.

The fix is to provide the service first.

Read the third slot before you run anything. It tells you what the edge still has to hand over.

That is the next part.
