@onrails/maybe 0.2.2 → 0.2.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/DESIGN.md +2 -0
- package/package.json +1 -1
package/DESIGN.md
CHANGED
|
@@ -6,6 +6,8 @@ Expected absence as a tagged union — not failure. Pairs with `@onrails/result`
|
|
|
6
6
|
|
|
7
7
|
- Same runtime model as `@onrails/result`: `{ _tag }` variants, dual-form module functions, `sideEffects: false`.
|
|
8
8
|
- Cross-carrier symmetry is spec-enforced (`test/symmetry.spec.ts`): shared ops keep the same name and dual arity as result's; channels mirror (`tapErr` ↔ `tapNone`); deliberate gaps are declared there. `of` = FL `pure` (alias of `some`); `show(m)` prints `Some(…)` / `None`.
|
|
9
|
+
- House style: `import * as Maybe from "@onrails/maybe"`, same rationale as `@onrails/result`'s `import * as R` — full-surface autocomplete, no name collisions.
|
|
10
|
+
- `fluent(m)` in `@onrails/maybe/fluent` mirrors `@onrails/result/fluent`'s bracket rule: opens with `fluent(...)`, closes with a terminal (`toMaybe`/`toString`/`match`/`unwrapOr`) in the same expression, never escapes as a return type, export, stored field, or serialize-sink argument. Enforced by `fluent-stays-local` in both lint plugins.
|
|
9
11
|
- **Some / None** — not Ok/Err. Do not use Maybe for parse/IO/auth failures.
|
|
10
12
|
- Optional `@onrails/maybe/interop` bridge (`toResult`, `fromResult`) keyed on `@onrails/result`.
|
|
11
13
|
|