cove v0.0.0 - Coalgebraic context layer for kont suspensions in Go
Pre-release
Pre-release
Introduction
covecarries ambient context acrosskontsuspension 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,covekeeps that context attached to values and suspensions throughViewandSuspensionView.covealso introduces two forms of context requirements: closure-basedReqfor direct use and data-basedReqExprfor 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]andSuspensionView[C, A]to pair values and suspensions with ambient context.Req[C]andReqExpr[C]withAll,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, andGuardedExprfor requirement-gated values.StepWith,StepExprWith,CheckSuspension,CheckSuspensionExpr, and resume helpers for contextual stepping.Reify,Reflect,ReifyReq, andReflectReqbridges between closure and expression worlds.
Compatibility
- Go:
1.26+