@fraczak/k 6.3.1 → 6.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/DOCS/REPL.md CHANGED
@@ -47,7 +47,7 @@ complete.
47
47
  | `:rels` | List relation aliases |
48
48
  | `:codec load file` | Load an importable REPL codec module |
49
49
  | `:codec list` | List loaded REPL codecs |
50
- | `:input type [codec]` | Read the next line as codec input for a singleton type |
50
+ | `:input type [codec]` | Read the next line as codec input for a type |
51
51
  | `:load [--no-alias] file` | Load `.k` source or `.klib` into the current state |
52
52
  | `:klib file` | Export the active relation closure as a `.klib` library |
53
53
  | `:ko file expr` | Export a `.ko` executable with `expr` as main |
@@ -139,7 +139,7 @@ Tab completion covers:
139
139
  Type aliases also complete in `$name` position inside raw k input.
140
140
 
141
141
  For codec commands, completion covers `:codec load`, `:codec list`, file paths
142
- after `:codec load`, singleton type names after `:input`, and loaded codec names
142
+ after `:codec load`, type names after `:input`, and loaded codec names
143
143
  after the input type.
144
144
 
145
145
  ## Loading
@@ -158,8 +158,10 @@ unless `--no-alias` is used.
158
158
 
159
159
  ## Codecs
160
160
 
161
- REPL codecs are keyed by canonical singleton code hashes. Open filters are not
162
- used for codec dispatch.
161
+ REPL codecs are usually keyed by canonical code hashes. Patterns are not used
162
+ for codec dispatch. A codec may also export `universal = true` to make it
163
+ available for any type selected by `:input`; the parsed value is still validated
164
+ against the requested type before it enters the session.
163
165
 
164
166
  ### `:codec load file`
165
167
 
@@ -172,15 +174,18 @@ export function parse(text) { /* text -> Value */ }
172
174
  export function print(value) { /* Value -> text */ }
173
175
  ```
174
176
 
175
- A codec may export `patterns` instead of `codes`; each pattern must be a
176
- singleton closed property-list pattern, and its code hash is recalculated by the
177
- REPL.
177
+ A codec may export `patterns` instead of `codes`; each pattern must be a closed
178
+ property-list pattern that can be canonicalized to a code hash, and that hash is
179
+ recalculated by the REPL. A universal codec exports `universal = true` instead
180
+ of `codes` or `patterns`.
178
181
 
179
182
  ### `:input type [codec]`
180
183
 
181
- Resolves `type` to a canonical singleton code, selects the registered codec,
182
- and consumes the next line verbatim as codec input. The parsed value is validated
183
- against that code before becoming the current value.
184
+ Resolves `type` to a canonical code hash, selects the registered codec, and
185
+ consumes the next line verbatim as codec input. `type` may be a type alias, a
186
+ canonical code hash, or an inline type expression such as
187
+ `<{} true, {} false>`. The parsed value is validated against that type before
188
+ becoming the current value.
184
189
 
185
190
  ## Export
186
191