| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Wire
Description
A table-driven codec for the small named-enum vocabularies the system speaks: the
ecosystem key, the log format and level, and the telemetry switch.
A WireVocab instance carries one (value, name) table plus the human noun for the
set. lookupWire, parseWire and renderWire all read that table, so a parse, a
render, and the accepted-set message cannot drift apart.
The vocabulary keys on the type, so each type speaks exactly one vocabulary.
Documentation
class WireVocab a where Source #
The wire vocabulary of a named-enum type. The (value, name) table is the single source of
truth for the codec.
Methods
The human noun for the vocabulary, e.g. "log format". Names the
accepted set in parseWires failure message.
wireTable :: NonEmpty (a, Text) Source #
Every value paired with its canonical wire name, in the order the accepted-set
message names them. It must list every inhabitant, because renderWire reads from it.
wireAliases :: [(a, Text)] Source #
Further spellings lookupWire accepts. An alias never reaches the accepted-set
message, and renderWire never emits one. Empty by default.
lookupWire :: WireVocab a => Text -> Maybe a Source #
The value a wire name denotes, through wireTable and then wireAliases.
Nothing for a name in neither.