0x0LearnReferenceLibrariesMigration0x0.jmp0x1b.com

Capabilities And Effects

Current implementation evidence: docs/language.html,

examples/pure-capability.0x0, and docs/runtime-capabilities.html.

Source Capability Annotations

Functions may include a capability annotation:


(cap pure)

Current capability names are:

Unannotated functions default to io.

Pure Functions

A pure function may call pure functions and pure builtins. It may not call

effectful builtins such as file, stdin/stdout, argv, env, print, panic, or

another non-pure function.

Example:


(ƒ add
  (∷ (→ I64 I64 I64))
  (cap pure)
  (a b)
  (+ a b))

Runtime Boundary

Capability annotations are source contracts. Runtime implementations are

separate boundaries documented under runtime capability docs.

network and process are accepted as source contracts for framework/runtime

boundaries, but the current core runtime does not expose generic socket or

subprocess builtins as ordinary language builtins.

Practical Rule

Put effects at the boundary. Keep parsing, validation, and transformation pure

where possible. Mark boundary functions with the narrowest capability that

matches the current implementation.