Skip to content

cove v0.0.0 - Coalgebraic context layer for kont suspensions in Go

Pre-release
Pre-release

Choose a tag to compare

@hayabusa-cloud hayabusa-cloud released this 10 Mar 09:06
· 24 commits to main since this release
ddef377

Introduction

  • cove carries ambient context across kont suspension boundaries as explicit, typed data. It is designed for runtimes that step one suspension at a time while still needing budget, capability, phase, or buffer-state information at each boundary. Instead of side maps or hidden globals, cove keeps that context attached to values and suspensions through View and SuspensionView.
  • cove also introduces two forms of context requirements: closure-based Req for direct use and data-based ReqExpr for composable boolean structure. On top of those requirements, the package provides named rules, diagnostics, and guarded values that can be checked before a step proceeds. The stepping helpers remain policy-free: they preserve and evolve context, but they do not schedule, retry, or dispatch. That keeps ownership clean across the wider stack while making contextual stepping easy to reason about and test.

Usage

type Runtime struct {
    Budget int
}

_, sv := cove.StepExprWith(Runtime{Budget: 8}, computation)
for sv.Suspension != nil {
    result := dispatch(sv.Ask(), sv.Op())
    _, sv = sv.ResumeWith(result, func(r Runtime) Runtime {
        r.Budget--
        return r
    })
}

Highlights

cove launches with a contextual stepping surface for kont, including typed carriers for ambient context, guarded values, and suspension-aware resume helpers. The release also ships both closure and expression forms of the requirement algebra so callers can choose between direct predicates and data-first composition.

Features

  • View[C, A] and SuspensionView[C, A] to pair values and suspensions with ambient context.
  • Req[C] and ReqExpr[C] with All, Any, Not, True, False, and pullback helpers for context predicates.
  • Rule[C], RuleExpr[C], Report, and rule-checking helpers for named diagnostics.
  • Checked, Guarded, CheckedExpr, and GuardedExpr for requirement-gated values.
  • StepWith, StepExprWith, CheckSuspension, CheckSuspensionExpr, and resume helpers for contextual stepping.
  • Reify, Reflect, ReifyReq, and ReflectReq bridges between closure and expression worlds.

Compatibility

  • Go: 1.26+