72e54f4fd3
The surface-form file extension changes from .ailx to .ail. AILang's
authoring surface now uses the same .ail stem as its canonical JSON
form (.ail.json), giving the language a single coherent extension
family: .ail is the LLM-authored Form A, .ail.json is the canonical
JSON-AST Form B.
Scope (touched):
- 61 example renames examples/**/*.ailx → .ail (git mv)
- 1 rename experiments/.../rendered/ailx.md → ail.md
- 35 content-edited live-toolchain files (crates/, docs/DESIGN.md,
docs/roadmap.md, docs/PROSE_ROUNDTRIP.md, skills/, bench/reference/*.c,
experiment crates under experiments/.../{render,harness,master})
- Experiment-crate cohort rename Cohort::Ailx → Cohort::Ail,
Form::Ailx → Form::Ail, per_cohort/ailx → per_cohort/ail,
{form-only: ailx} → {form-only: ail}, ```ailx → ```ail
Out of scope (deliberately untouched, to preserve honest history):
- docs/journal-archive.md (content-frozen per CLAUDE.md)
- docs/journals/, docs/specs/, docs/plans/, bench/orchestrator-stats/
- experiments/.../runs/ (frozen LLM-output artefacts; models actually
saw .ailx — renaming would falsify the experimental record)
Verification: cargo build/test --workspace green; experiment crate
cargo test green; bench/check.py + compile_check.py + cross_lang.py
all 0-regressed; negative grep for ailx|Ailx|AILX outside the
out-of-scope paths returns zero matches.
Opens immediate follow-up: roadmap.md P2 todo `ail check`/build/run
accept .ail extension — after this rename, .ail is canonical
authoring surface but the CLI still produces a misleading JSON-parse
error on `ail check foo.ail`. That's the next iter.
65 lines
1.6 KiB
Plaintext
65 lines
1.6 KiB
Plaintext
; Iter 15a — first stdlib module: optional values.
|
|
; Polymorphic Maybe with four pure combinators.
|
|
|
|
(module std_maybe
|
|
|
|
(data Maybe (vars a)
|
|
(doc "Polymorphic optional value: either Just<a> or Nothing.")
|
|
(ctor Nothing)
|
|
(ctor Just a))
|
|
|
|
(fn from_maybe
|
|
(doc "Project out of Maybe<a> with a default for the Nothing case.")
|
|
(type
|
|
(forall (vars a)
|
|
(fn-type
|
|
(params a (con Maybe a))
|
|
(ret a))))
|
|
(params default m)
|
|
(body
|
|
(match m
|
|
(case (pat-ctor Just x) x)
|
|
(case (pat-ctor Nothing) default))))
|
|
|
|
(fn is_some
|
|
(doc "Returns true iff m is Just<_>.")
|
|
(type
|
|
(forall (vars a)
|
|
(fn-type
|
|
(params (con Maybe a))
|
|
(ret (con Bool)))))
|
|
(params m)
|
|
(body
|
|
(match m
|
|
(case (pat-ctor Just _) true)
|
|
(case (pat-ctor Nothing) false))))
|
|
|
|
(fn is_none
|
|
(doc "Returns true iff m is Nothing.")
|
|
(type
|
|
(forall (vars a)
|
|
(fn-type
|
|
(params (con Maybe a))
|
|
(ret (con Bool)))))
|
|
(params m)
|
|
(body
|
|
(match m
|
|
(case (pat-ctor Just _) false)
|
|
(case (pat-ctor Nothing) true))))
|
|
|
|
(fn map_maybe
|
|
(doc "Apply f to the wrapped value, or pass Nothing through.")
|
|
(type
|
|
(forall (vars a b)
|
|
(fn-type
|
|
(params (fn-type (params a) (ret b))
|
|
(con Maybe a))
|
|
(ret (con Maybe b)))))
|
|
(params f m)
|
|
(body
|
|
(match m
|
|
(case (pat-ctor Just x)
|
|
(term-ctor Maybe Just (app f x)))
|
|
(case (pat-ctor Nothing)
|
|
(term-ctor Maybe Nothing))))))
|