agentleFS
rainoftimerainoftime/pl-skills/effect-handlers-implementer/SKILL.md

effect-handlers-implementer

Skill17 starsChanged 9 months agoApache-2.0View on GitHub

Implements effect handlers for algebraic effects. Use when: (1) Building

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:

    Start with simple effects (state, fail)

    line 71
  2. Distinctive:

    Use effect rows for polymorphism

    line 72
  3. Distinctive:

    Test handlers in isolation

    line 74
  4. Distinctive:

    Consider performance of continuations

    line 75

≈ “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 Handlers Implementer

Implements effect handlers for algebraic effects and resumable exceptions.

When to Use

  • Building effect systems
  • Implementing custom effects (I/O, state, nondeterminism)
  • Creating extensible effect systems
  • Implementing error handling
  • Building async/await with effects

What This Skill Does

  1. Defines effects - Algebraic effect signatures
  2. Implements handlers - Effect interpretation
  3. Manages continuations - Resumable computations
  4. Composes handlers - Layered interpretations

Key Concepts

ConceptDescription
EffectOperation signature (type of operations)
HandlerInterpretation of effects
ContinuationRemaining computation
ResumptionContinue after handling
AbortStop computation

Common Effects

EffectOperationsHandler
Stateget, putStateHandler
Exceptionsthrow, catchFailHandler
I/Oread, writeIOHandler
Non-detchoose, failChoiceHandler
RandomrandomRandomHandler
Asyncasync, awaitAsyncHandler

Handler Composition

PatternDescription
ShallowOne-shot handling
DeepIntercept nested effects
ScopedDynamic handler scope
LayeredMultiple handlers

Tips

  • Start with simple effects (state, fail)
  • Use effect rows for polymorphism
  • Handle resource cleanup with finally
  • Test handlers in isolation
  • Consider performance of continuations

Related Skills

  • effect-type-system - Effect type systems
  • polymorphic-effects - Effect polymorphism
  • lambda-calculus-interpreter - Basic interpretation

Canonical References

ReferenceWhy It Matters
Plotkin & Pretnar, "Handlers of Algebraic Effects" (2009)Original effect handlers
Koka LanguageProduction effect system
Eff LanguageResearch effect language
Frank LanguageEffect handlers in practice

Tradeoffs and Limitations

Approaches

ApproachProsCons
MonadicSimple, composableVerbose
Effect handlersExtensible, modularComplex implementation
Delimited continuationsPowerfulHard to use

Limitations

  • Performance overhead for continuations
  • Complex to implement correctly
  • Debugging is challenging
  • Limited static analysis
  • Some effects can't be handler

Research Tools & Artifacts

Real-world effect handler implementations:

ToolWhy It Matters
KokaProduction language with effect types
FrankEffect handlers research language
EffEffect handlers implementation
OCaml effectsExperimental effects in OCaml
Multicore OCamlEffect handlers for OCaml

Key Systems

  • Koka: Microsoft research effect language
  • Frank: Chameleon in the forest

Research Frontiers

Current effect handler research:

DirectionKey PapersChallenge
Typed handlers"Handlers of Algebraic Effects"Type-safe handlers
Continuations"Delimited Control"Efficient continuations
Effect polymorphism"Polymorphic Effects"Reusable handlers

Hot Topics

  1. Effect handlers for web: Async via handlers
  2. Effects in Rust: Effects RFC discussion

Implementation Pitfalls

Common effect handler bugs:

PitfallReal ExamplePrevention
Resume after abortDouble resumeTrack state
Stack overflowDeep continuationsTail-call opt
Handler orderWrong handler catchesOrder matters

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.