Skip to content

Protocol Atlas

Hara’s foundation protocols are a compact vocabulary for constructing values, collections, stateful components, deferred work, and live runtime systems. Their canonical identities live under std.protocol.*.

The Atlas is both a reference and a course map. Protocol families with a complete interactive lab link directly to it; the remaining families identify the next labs to build.

ProtocolCanonical namespaceMethods
IDisplaystd.protocol.idisplaydisplay
IEqualitystd.protocol.iequalityequality
IHashstd.protocol.ihashhash
IHashCachedstd.protocol.ihashcachedhash-current, hash-put
INamespacedstd.protocol.inamespacedname, namespace
IObjTypestd.protocol.iobjtypemeta, with-meta
IExInfostd.protocol.iexinfodata
IPointerstd.protocol.ipointerptr-context, ptr-keys, ptr-val

These protocols keep display, equality, hashing, metadata, naming, error data, and indirect references as deliberate choices rather than one bundled object identity.

ProtocolCanonical namespaceMethods
IEncodestd.protocol.iencodeencode
IEncodablestd.protocol.iencodableencode-with
IEncodeVisitorstd.protocol.iencodevisitorvisit-nil, visit-boolean, visit-number, visit-character, visit-string, visit-keyword, visit-symbol, visit-seq, visit-vector, visit-map, visit-set, visit-tagged, visit-unknown

Encoding is separated from the value’s storage and from the concrete output format.

ProtocolCanonical namespaceMethods
ICountstd.protocol.icountcount
IEmptystd.protocol.iemptyempty
ILookupstd.protocol.ilookuplookup
IFindstd.protocol.ifindfind
INthstd.protocol.inthnth
IIndexedstd.protocol.iindexedindex-of
IIndexedKVstd.protocol.iindexedkvindex-of-key, index-of-val
IPairstd.protocol.ipairkey, value

A collection is not required to inherit from one universal base class. It can provide only the abilities that make sense for its representation.

Work through these contracts in Collection Protocols →{ .md-button .md-button—primary }

ProtocolCanonical namespaceMethods
IAssocstd.protocol.iassocassoc
IDissocstd.protocol.idissocdissoc
IConjstd.protocol.iconjconj
IConsstd.protocol.iconscons
IPeekFirststd.protocol.ipeekfirstpeek-first
IPeekLaststd.protocol.ipeeklastpeek-last
IPopFirststd.protocol.ipopfirstpop-first
IPopLaststd.protocol.ipoplastpop-last
IPushFirststd.protocol.ipushfirstpush-first
IPushLaststd.protocol.ipushlastpush-last

The separate contracts make collection direction, update semantics, and return shape visible.

Practice persistent updates and direction →{ .md-button }

ProtocolCanonical namespaceMethods
IIterstd.protocol.iiteriter
IIteratorstd.protocol.iiteratoriter-next?, iter-next
IReducestd.protocol.ireducereduce

Persistent collections, lazy sequences, generated values, and one-shot sources can participate in shared algorithms without pretending to have identical resource behaviour.

Acquire and advance an explicit iterator →{ .md-button }

ProtocolCanonical namespaceMethods
IMutablestd.protocol.imutablemarker protocol
IPersistentstd.protocol.ipersistentmarker protocol
IToMutablestd.protocol.itomutableto-mutable
IToPersistentstd.protocol.itopersistentto-persistent

Hara treats mutable and persistent representations as explicit design boundaries.

07 — Work with state and deferred results

Section titled “07 — Work with state and deferred results”
ProtocolCanonical namespaceMethods
IDerefstd.protocol.iderefderef
IDerefTimeoutstd.protocol.idereftimeoutderef-timeout
IResetstd.protocol.iresetreset
ICasstd.protocol.icascas
IWatchstd.protocol.iwatchwatch-add, watch-remove, watch-list
IRealizestd.protocol.irealizerealized?, realize
IPromisestd.protocol.ipromisestate, value, then, catch, finally, cancel
ICoroutinestd.protocol.icoroutinestatus, resume

Reading, replacing, observing, awaiting, settling, cancelling, suspending, and resuming are different capabilities.

Work through these contracts in State and Lifecycle Protocols →{ .md-button .md-button—primary }

ProtocolCanonical namespaceMethods
IFnstd.protocol.ifninvoke
IOFnstd.protocol.iofnmarker protocol
IApplicablestd.protocol.iapplicableapply-in, apply-default, transform-in, transform-out
IInvokeInstd.protocol.iinvokeininvoke-in
IContextstd.protocol.icontextcall
IContextLifeCyclestd.protocol.icontextlifecyclehas-module?, setup-module, teardown-module, has-pointer?, setup-pointer, teardown-pointer

These contracts move from calling a function to invoking work inside explicit runtime and transformation contexts.

ProtocolCanonical namespaceMethods
IClosestd.protocol.icloseclose
IComponentstd.protocol.icomponentprops, status, started?, stopped?, start, stop, kill, remote?
ISpacestd.protocol.ispacecontext-set, context-unset, context-list, context-get, rt-active, rt-get, rt-start, rt-started?, rt-stopped?, rt-stop

Components and runtime spaces make lifecycle, ownership, and active execution visible.

IClose is introduced in the state and lifecycle lab; component and space contracts will form the live-systems lab.

Hara also places portable domain contracts under std.protocol.*. The current standard test family includes IMatch, ITestClock, ITestTimer, ITestControl, ITestRegistry, ITestReporter, and ITestSession.

These demonstrate the larger pattern: a test system is assembled from replaceable contracts for matching, time, cancellation, registration, reporting, execution, results, and closure.

Start the collection lab →{ .md-button .md-button—primary } Continue with state and lifecycle →{ .md-button } Return to Protocols for Builders →{ .md-button }