checking-option-and-either-cases

checking-option-and-either-cases is a cursor rule for Cursor from PaulJPhilp/EffectPatterns. It costs 371 tokens per session, scanned A, original, MIT.

A pattern for checking whether an Option contains a value or whether an Either represents success or failure.

In plain words
What is it for?
Use it to handle optional data with Option and successful or failed results with Either in Effect-TS code.
Why use it?
It makes conditional handling explicit and type-safe instead of relying on unclear null checks or unstructured error values.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it to handle optional data with Option and successful or failed results with Either in Effect-TS code.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/pauljphilp/effectpatterns/checking-option-and-either-cases
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/PaulJPhilp/EffectPatterns

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for checking-option-and-either-cases

README.md
[![agentmods](https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/checking-option-and-either-cases/github.svg)](https://agentmods.dev/rules/pauljphilp/effectpatterns/checking-option-and-either-cases)
Your own site
<a href="https://agentmods.dev/rules/pauljphilp/effectpatterns/checking-option-and-either-cases"><img src="https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/checking-option-and-either-cases/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for checking-option-and-either-cases

Your own site · 80×15
<a href="https://agentmods.dev/rules/pauljphilp/effectpatterns/checking-option-and-either-cases"><img src="https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/checking-option-and-either-cases.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 371 This file is loaded in full into every session.
When invoked 371 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00371 $0.00371
Opus 5.5 $0.00148 $0.00148
Sonnet 5.5 $0.00074 $0.00074
Haiku 4.5 $0.00037 $0.00037

Measured 3mo ago against content hash 201f65972f93, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

checking-option-and-either-cases scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

content/published/rules/cursor/checking-option-and-either-cases.mdc · 46 lines

What it actually says

description: Use isSome, isNone, isLeft, and isRight to check Option and Either cases for simple, type-safe conditional logic. globs: "**/*.ts" alwaysApply: true

Checking Option and Either Cases

Rule: Use isSome, isNone, isLeft, and isRight to check Option and Either cases for simple, type-safe conditional logic.

Example

import { Option, Either } from "effect";

// Option: Check if value is Some or None
const option = Option.some(42);

if (Option.isSome(option)) {
  // option.value is available here
  console.log("We have a value:", option.value);
} else if (Option.isNone(option)) {
  console.log("No value present");
}

// Either: Check if value is Right or Left
const either = Either.left("error");

if (Either.isRight(either)) {
  // either.right is available here
  console.log("Success:", either.right);
} else if (Either.isLeft(either)) {
  // either.left is available here
  console.log("Failure:", either.left);
}

// Filtering a collection of Options
const options = [Option.some(1), Option.none(), Option.some(3)];
const presentValues = options.filter(Option.isSome).map((o) => o.value); // [1, 3]

Explanation:

  • Option.isSome and Option.isNone let you check for presence or absence.
  • Either.isRight and Either.isLeft let you check for success or failure.
  • These are especially useful for filtering or quick conditional logic.

Explanation:
These predicates provide a concise, type-safe way to check which case you have, without resorting to manual property checks or unsafe type assertions.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 46 lines · 371 tokens per session scan A 201f65972f93

Subscribe to this mod's changes

checking-option-and-either-cases is a cursor rule published in the GitHub repository PaulJPhilp/EffectPatterns (807 stars, last pushed 5mo ago), licensed MIT. It adds 371 tokens to every session, about $0.0015 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

checking-option-and-either-cases compared with cursor rules from other repositories

checking-option-and-either-cases next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
checking-option-and-either-casesPaulJPhilp/EffectPatternsCursor rule8075mo agoMITA371Cursor
fastapi-components-and-validationWebDevPeterGriffin/The-VibeCode-BibleCursor rule4226d agononeA64Cursor
accessibilityWebDevPeterGriffin/The-VibeCode-BibleCursor rule4226d agononeA0Cursor
verify-information-ruleWebDevPeterGriffin/The-VibeCode-BibleCursor rule4226d agononeA46Cursor
new-user-experience-nux-flow-ruleWebDevPeterGriffin/The-VibeCode-BibleCursor rule4226d agononeA0Cursor
globalexceptionhandler-classWebDevPeterGriffin/The-VibeCode-BibleCursor rule4226d agononeA27Cursor
ponytailDietrichGebert/ponytailCursor rule201k8d agoMITA604Cursor