agentleFS
rainoftimerainoftime/pl-skills/effect-system/SKILL.md

effect-system

Skill17 starsChanged 9 months agoApache-2.0View on GitHub

Implement effect systems to track and control side effects in programs.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Effect Checking: Verify effect constraints

    line 26
  2. Distinctive:

    Start with coarse-grained effects (IO vs Pure)

    line 44
  3. Distinctive:

    Use row polymorphism for flexibility

    line 45
  4. Distinctive:

    When side effects are not a concern

    line 85

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Effect System

Effect systems track what computational effects a function may perform, enabling reasoning about purity, exceptions, I/O, and other side effects at the type level.

When to Use This Skill

  • Building pure functional languages
  • Reasoning about side effects
  • Implementing effect handlers
  • Security and sandboxing
  • Optimization (pure code can be optimized more)

What This Skill Does

  1. Effect Annotation: Track effects in types
  2. Effect Checking: Verify effect constraints
  3. Effect Polymorphism: Generic effect handling
  4. Effect Row Types: Combine multiple effects
  5. Effect Masking: Hide effects from callers

Key Concepts

ConceptDescription
EffectComputational side effect (IO, State, Throw)
Effect SetCollection of effects
Effect RowExtensible row of effects
Effect PolymorphismGeneric over effect sets
Effect HandlerInterpret effects
PureNo effects

Tips

  • Start with coarse-grained effects (IO vs Pure)
  • Use row polymorphism for flexibility
  • Consider effect subtyping
  • Effect handlers enable flexible interpretation
  • Log effects for debugging

Common Use Cases

  • Pure functional languages
  • Effect tracking for optimization
  • Sandboxing and security
  • Effect-based testing
  • Resource management

Related Skills

  • algebraic-effects - Algebraic effect handlers
  • type-class-implementer - Monad type classes
  • monad-transformer - Monad transformers
  • information-flow-analyzer - Security effects

Canonical References

ReferenceWhy It Matters
Lucassen & Gifford, "Polymorphic Effect Systems" (POPL 1988)Original paper on effect systems
Talpin & Jouvelot, "The Type and Effect Discipline" (POPL 1992)Effect polymorphism formalization
Leijen, "Koka: Programming with Row Polymorphic Effect Handlers" (2017)Modern effect system design

Tradeoffs and Limitations

Approach Tradeoffs

ApproachProsCons
MonadsComposableSyntactic overhead
Effect systemsCleaner syntaxComplex inference
Algebraic effectsFlexibleRuntime overhead

When NOT to Use This Skill

  • When side effects are not a concern
  • Performance-critical code
  • When exceptions suffice

Limitations

  • Effect inference can be complex
  • Higher-order effects are tricky
  • Interaction with existing code

Assessment Criteria

A high-quality implementation should have:

CriterionWhat to Look For
SoundnessAll effects tracked
InferenceAutomatic effect inference
PolymorphismEffect polymorphism
HandlersEffect interpretation

Quality Indicators

✅ Good: Sound, infers effects, supports polymorphism ⚠️ Warning: Manual annotations required ❌ Bad: Misses effects, no polymorphism

Research Tools & Artifacts

Effect system implementations:

ToolLanguageWhat to Learn
KokaKokaRow-based effects
FrankFrankHandler calculus
EffEffDirect handlers
Multicore OCamlOCamlEffects in OCaml

Research Frontiers

1. Effect Inference

  • Goal: Automatic effect tracking
  • Papers: "Effect Inference" (various)

Implementation Pitfalls

PitfallReal ConsequenceSolution
Effect inferenceComplexityUse bidirectional

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.