Put what can go wrong in the type. Let your agent check it.
Option, Either, Try, List and IO for TypeScript. Missing values, errors and effects become types the compiler checks. Your coding agent runs the same checks through one MCP call, and every error says what to write instead.
port is a plain number8080PORT="8080" stays a value the whole way down.Your agent checks its work before you see it.
One call type-checks and lints the code. Every error names the fix.
The bug compiles. The check doesn't let it through.
users.save returns an Either, so a failed save is a value, not a throw. Drop it and TypeScript says nothing: the user is welcomed whether or not the save worked.
validate_code runs the compiler and functype's lint preset, and the error tells the agent what to write instead.
- You
Save the new user, then welcome them.
- Agenttsc: 0 errors7export const register = (user: User): string => {8 users.save(user)9 return `Welcome, ${user.email}`10}
- validate_code
✗ Line 8: This result is dropped, so a failure in it is silently ignored. Check isLeft() / isFailure(), fold it, or return it.functype/no-floating-result
- Agent- register = (user: User): string => { …+ register = (user: User): Either<SaveError, string> =>+ users.save(user).map((saved) => `Welcome, ${saved.email}`)
- validate_code
✓ PASSED. The code is type-correct and passes the lint preset.
MCP server
validate_code type-checks and lints a snippet before you see it.
npx -y functype-mcp-serverClaude Code plugin
The skills and the MCP server in one install.
/plugin marketplace add jordanburke/functype/plugin install functypeESLint plugin
One preset where every rule is an error or off, and every message names the fix.
npm i -D eslint-plugin-functypeDocs as text
The whole library in one file, for any model that can fetch a URL.
functype.org/llms-full.txtFour types for the four ways code goes wrong.
Each has a shape for the value and a shape for what happened instead. You handle the problem once, where it makes sense.
The value may not be there.
It failed, and E says how.
The code it ran may throw.
An effect. It needs services R, can fail with E, and runs only when you run it.
Building an IO runs nothing.
greet(id) returns a plan. Build it as often as you like and the lookup count stays at zero. It runs when you run it.
import { IO, Option, Tag } from "functype" type User = { readonly id: string; readonly name: string } class NotFound { readonly _tag = "NotFound" } const Users = Tag<{ readonly find: (id: string) => User | undefined }>("Users") const greet = (id: string) => IO.service(Users) .flatMap((users) => IO.fromOptionOrFail(Option(users.find(id)), () => new NotFound())) .map((u) => `Hello, ${u.name}`) .catchTag("NotFound", () => IO.succeed("Hello, guest"))
Small and fast, measured.
Against Effect 4.1.5 on Node 24.20.0, with functype built from main.All 10 benchmarks: 8 faster, 1 about the same, 1 slower
A million chained steps run without a stack overflow, and there are no runtime dependencies.