بنقرة واحدة
algebraic-effects
Implements algebraic effects and effect handlers for computational effects in typed languages.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Implements algebraic effects and effect handlers for computational effects in typed languages.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Implement abstract machines for defining and executing operational semantics of programming languages.
Implements alias and points-to analysis for pointer programs. Use for: (1) Optimizing compilers, (2) Verifying memory safety, (3) Program understanding, (4) Parallelization.
Define program meaning through logical assertions and proof rules (Hoare logic).
Transforms closures to explicit environments. Use when: (1) Implementing functional languages, (2) Building compilers, (3) Understanding closures.
Implements common subexpression elimination (CSE). Use when: (1) Building compilers, (2) Optimizing code, (3) Program analysis.
Implements general dataflow analysis framework. Use when: (1) Building compilers, (2) Static analysis tools, (3) Program verification.
| name | algebraic-effects |
| description | Implements algebraic effects and effect handlers for computational effects in typed languages. |
| version | 1.0.0 |
| tags | ["effects","type-theory","semantics","handlers","monads"] |
| difficulty | advanced |
| languages | ["ocaml","haskell","eff","python"] |
| dependencies | ["effect-system","type-inference-engine"] |
Implements algebraic effects and effect handlers - a modular approach to computational effects where effects are described as operations and handled by handler functions.
| Concept | Description |
|---|---|
| Effect Operation | Abstract description of an effect (e.g., State.get, State.put) |
| Effect Handler | Function that interprets effect operations |
| Resumption | Continuation passed to handler for resuming computation |
| Effect Row | Collection of effects tracked in type system |
effect-system - Effect type trackingmonad-transformer - Alternative effect compositiontype-inference-engine - Effect inference| Reference | Why It Matters |
|---|---|
| Plotkin & Pretnar "Handlers of Algebraic Effects" (2009) | Foundational effect handlers paper |
| Bauer & Pretnar "Programming with Algebraic Effects and Handlers" | Eff language implementation |
| Leijen "Koka: Programming with Row Polymorphic Effect Types" (2014) | Effect rows in practice |
| Kammar et al. "Handlers in Action" (ICFP 2013) | Comprehensive handler study |
| Approach | Pros | Cons |
|---|---|---|
| Deep handlers | Full resumption, composable | Complex continuation management |
| Shallow handlers | Simpler implementation | Limited expressiveness |
| Monadic encoding | Familiar, pure | Effets verbosity, lack of local reasoning |
| Criterion | What to Look For |
|---|---|
| Type safety | Effect operations well-typed |
| Handler correctness | Operations correctly interpreted |
| Performance | Minimal overhead vs monadic approach |
| Composability | Handlers can be layered |
✅ Good: Type-safe, correct handlers, good performance, composable ⚠️ Warning: Partial type safety, some handler issues ❌ Bad: Type errors, incorrect handler behavior
Algebraic effect implementations:
| Tool | Language | What to Learn |
|---|---|---|
| Eff | OCaml | Original implementation |
| Koka | Koka | Effect types |
| Frank | Frank | Handler calculus |
| Idris 2 | Idris | Effects |
| Pitfall | Real Consequence | Solution |
|---|---|---|
| Continuation leak | Memory issues | Proper resumption handling |
| Effect row ambiguity | Unclear effect set | Explicit row variables |
| Handler ordering | Wrong semantics | Define evaluation order |