cove v0.1.0 - Contextual stepping for kont suspensions
·
15 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
Introduction
coveis the context layer of the nonblocking I/O stack. Around akontcomputation that is advanced one suspension at a time,covekeeps ambient state — dispatch budget, ring capabilities, protocol phase, buffer-group validity, and similar runtime facts — as typed, composable data instead of hidden globals or ad-hoc side maps.- The package is policy-free by design: it carries context, checks requirements, and exposes the current suspension boundary, but it never schedules, retries, classifies outcomes, or talks to the kernel. Those responsibilities stay with
takt,iox, anduring. - The public surface of
covepackage:Viewas the ambient carrier,SuspensionViewas the contextual observation boundary overkont.Suspension,Cmdfor contextual commands,Req/ReqExprfor context predicates in closure and data form,Rule/RuleExprplusReportfor named diagnostics, and requirement-gated value carriersCheckedandGuarded.
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
})
}
// Completion clears the suspension; the carried context is preserved.
_ = sv.Ask()Highlights
cove ships an explicit context algebra for kont suspensions without becoming a runtime. The surface covers contextual stepping, contextual commands, composable requirements (closure and data forms), named rule diagnostics with reports, requirement- and rule-gated value carriers, and bridge helpers between the closure and expression worlds.
Features
Public Surface
- Ambient carrier.
View[C, A]withObserve,Extract,Ask,Map,MapContext,Replace,WithContext,Duplicate, andExtend. - Contextual commands.
Cmd[C, A, B]withRun,ExtractCmd,LiftCmd, andComposefor command composition throughExtend. - Contextual stepping.
SuspensionView[C, A],ObserveSuspension,StepWith,StepExprWith,Step,StepExpr,Op,Resume,ResumeWith, andDiscardfor steppingkontcomputations under ambient context;MapContextSuspensionandWithContextSuspensionfor explicit context transport on already-observed suspensions. - Requirements.
Req[C]withNeed,Pullback,All,Any,Not,True,False;ReqExpr[C]withNeedExpr,ExprAtom,ExprPullback,ExprAll,ExprAny,ExprNot,ExprTrue,ExprFalseas a defunctionalized Boolean algebra over predicates. - Diagnostics.
Rule[C],RuleExpr[C],Report,RuleError,Require,RequireExpr,PullbackRule,CheckRule,CheckRules,CheckRuleExpr, andCheckRulesExprfor named, ordered diagnostic checks. - Gated values.
Checked[C, A],CheckedExpr[C, A],Guarded[C, A], andGuardedExpr[C, A]as requirement-gated and rule-gated value carriers, withGuard,GuardExpr,GuardRule,GuardRuleExpr,IntoView,MustView,MapChecked,MapGuarded,PullbackChecked, andPullbackGuarded. - Bridges.
Reify,Reflect,ReifyReq, andReflectReqbetween the closure and expression worlds. - Gated suspensions.
CheckSuspensionandCheckSuspensionExprgate contextualization of a rawkont.Suspensionon a requirement.
Behavioural contracts
SuspensionViewis affine: each suspension is consumed exactly once viaResume,ResumeWith, orDiscard.- Completion preserves carried context: when stepping reaches the terminal boundary,
sv.Suspensionbecomesnilwhilesv.Ask()still returns the ambient context. coveperforms no scheduling, retry, or outcome classification; semantic outcome branching belongs toiox, kernel mechanics belong touring, and proactor advancement belongs totakt.
Laws
Duplicate(v).Extract() == vExtend(v, func(w View[C, A]) A { return w.Extract() }) == vCompose(g, f)(v) == g(Extend(v, f))Compose(ExtractCmd, f) == fandCompose(g, ExtractCmd) == g
Compatibility
- Go:
1.26+