diff --git a/bench/orchestrator-stats/2026-05-14-iter-rpe.1.json b/bench/orchestrator-stats/2026-05-14-iter-rpe.1.json new file mode 100644 index 0000000..7bea856 --- /dev/null +++ b/bench/orchestrator-stats/2026-05-14-iter-rpe.1.json @@ -0,0 +1,36 @@ +{ + "iter_id": "rpe.1", + "date": "2026-05-14", + "mode": "standard", + "outcome": "DONE", + "tasks_total": 10, + "tasks_completed": 10, + "reloops_per_task": { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 0, + "7": 0, + "8": 0, + "9": 0, + "10": 0 + }, + "review_loops_spec": 0, + "review_loops_quality": 0, + "blocked_reason": null, + "tests_passed": 564, + "tests_failed": 0, + "files_changed": 121, + "bench_check_exit": 0, + "bench_compile_check_exit": 0, + "bench_cross_lang_exit": 0, + "ratified_baselines": [], + "plan_unanticipated_sites": [ + "crates/ail/tests/e2e.rs::int_arg_to_effect_op_does_not_rc_track assertions", + "crates/ail/tests/snapshots/{sum,list,max3,ws_main}.ll IR regen", + "crates/ailang-core/tests/hash_pin.rs::ct4_migrated_fixtures_have_canonical_form_hashes", + "5 ancillary .ail comment touch-ups to satisfy §H acceptance grep" + ] +} diff --git a/crates/ail/src/main.rs b/crates/ail/src/main.rs index 04033ee..55cd434 100644 --- a/crates/ail/src/main.rs +++ b/crates/ail/src/main.rs @@ -27,8 +27,8 @@ //! a native binary at `--out`. //! - `run` — `build` into a tempdir and execute the binary; passes //! the binary's exit code through. -//! - `builtins` — list the built-in effect ops (`io/print_int`, -//! `io/print_bool`, `io/print_str`, ...) with their signatures. +//! - `builtins` — list the built-in effect ops (`io/print_str`) +//! with their signatures. //! - `diff` — semantic, hash-based module/workspace diff. Works even //! when a module doesn't currently typecheck. //! - `workspace` — load an entry module's transitive imports and list @@ -1416,7 +1416,7 @@ fn walk_term( walk_term(else_, out, builtins, scope); } Term::Do { op, args, .. } => { - // Mark effect ops as `effect:io/print_int` so they can be + // Mark effect ops as `effect:io/print_str` so they can be // separated from normal function calls. out.insert(format!("effect:{op}")); for a in args { diff --git a/crates/ail/tests/e2e.rs b/crates/ail/tests/e2e.rs index bb743c5..efd062d 100644 --- a/crates/ail/tests/e2e.rs +++ b/crates/ail/tests/e2e.rs @@ -1460,8 +1460,14 @@ fn reuse_as_demo_under_rc_uses_inplace_rewrite() { root_dir: ws.root_dir.clone(), registry: ws.registry.clone(), }; + // Iter rpe.1: post-print-migration, fixtures use `(app print x)` + // which monomorphises to `print__`. Adding the mono pass here + // mirrors `ail build`'s pipeline (desugar -> lift -> mono -> + // lower); without it, lowering errors with `UnknownVar("print")`. + let mono_ws = ailang_check::monomorphise_workspace(&lifted_ws) + .expect("monomorphise_workspace"); let ir = ailang_codegen::lower_workspace_with_alloc( - &lifted_ws, + &mono_ws, ailang_codegen::AllocStrategy::Rc, ) .expect("lower workspace under rc"); @@ -1660,8 +1666,14 @@ fn alloc_rc_borrow_only_recursive_list_drop() { root_dir: ws.root_dir.clone(), registry: ws.registry.clone(), }; + // Iter rpe.1: post-print-migration, fixtures use `(app print x)` + // which monomorphises to `print__`. Adding the mono pass here + // mirrors `ail build`'s pipeline (desugar -> lift -> mono -> + // lower); without it, lowering errors with `UnknownVar("print")`. + let mono_ws = ailang_check::monomorphise_workspace(&lifted_ws) + .expect("monomorphise_workspace"); let ir = ailang_codegen::lower_workspace_with_alloc( - &lifted_ws, + &mono_ws, ailang_codegen::AllocStrategy::Rc, ) .expect("lower workspace under rc"); @@ -1736,8 +1748,14 @@ fn alloc_rc_partial_drop_skips_moved_keeps_wildcarded() { root_dir: ws.root_dir.clone(), registry: ws.registry.clone(), }; + // Iter rpe.1: post-print-migration, fixtures use `(app print x)` + // which monomorphises to `print__`. Adding the mono pass here + // mirrors `ail build`'s pipeline (desugar -> lift -> mono -> + // lower); without it, lowering errors with `UnknownVar("print")`. + let mono_ws = ailang_check::monomorphise_workspace(&lifted_ws) + .expect("monomorphise_workspace"); let ir = ailang_codegen::lower_workspace_with_alloc( - &lifted_ws, + &mono_ws, ailang_codegen::AllocStrategy::Rc, ) .expect("lower workspace under rc"); @@ -1826,8 +1844,14 @@ fn alloc_rc_own_param_dec_at_fn_return() { root_dir: ws.root_dir.clone(), registry: ws.registry.clone(), }; + // Iter rpe.1: post-print-migration, fixtures use `(app print x)` + // which monomorphises to `print__`. Adding the mono pass here + // mirrors `ail build`'s pipeline (desugar -> lift -> mono -> + // lower); without it, lowering errors with `UnknownVar("print")`. + let mono_ws = ailang_check::monomorphise_workspace(&lifted_ws) + .expect("monomorphise_workspace"); let ir = ailang_codegen::lower_workspace_with_alloc( - &lifted_ws, + &mono_ws, ailang_codegen::AllocStrategy::Rc, ) .expect("lower workspace under rc"); @@ -1952,8 +1976,14 @@ fn iter18e_drop_iterative_emits_worklist_body_no_self_recursion() { root_dir: ws.root_dir.clone(), registry: ws.registry.clone(), }; + // Iter rpe.1: post-print-migration, fixtures use `(app print x)` + // which monomorphises to `print__`. Adding the mono pass here + // mirrors `ail build`'s pipeline (desugar -> lift -> mono -> + // lower); without it, lowering errors with `UnknownVar("print")`. + let mono_ws = ailang_check::monomorphise_workspace(&lifted_ws) + .expect("monomorphise_workspace"); let ir = ailang_codegen::lower_workspace_with_alloc( - &lifted_ws, + &mono_ws, ailang_codegen::AllocStrategy::Rc, ) .expect("lower workspace under rc"); @@ -2036,8 +2066,14 @@ fn iter18e_no_annotation_keeps_recursive_drop_body() { root_dir: ws.root_dir.clone(), registry: ws.registry.clone(), }; + // Iter rpe.1: post-print-migration, fixtures use `(app print x)` + // which monomorphises to `print__`. Adding the mono pass here + // mirrors `ail build`'s pipeline (desugar -> lift -> mono -> + // lower); without it, lowering errors with `UnknownVar("print")`. + let mono_ws = ailang_check::monomorphise_workspace(&lifted_ws) + .expect("monomorphise_workspace"); let ir = ailang_codegen::lower_workspace_with_alloc( - &lifted_ws, + &mono_ws, ailang_codegen::AllocStrategy::Rc, ) .expect("lower workspace under rc"); @@ -2671,18 +2707,27 @@ fn str_field_in_adt_drops_heap_str_correctly() { assert_eq!(live, 0, "no leaked RC slabs allowed; live={live}"); } -/// Iter eob.1: primitive-Int arg passed to an effect-op. Under the -/// new "Term::Do args = Borrow" rule, the let-binder `n` is not -/// consumed by `io/print_int`; but Int is unboxed, so there is no -/// pointer to RC-track. Pin: zero allocs / zero frees / zero live — -/// the rule introduces no spurious bookkeeping on primitives. +/// Iter eob.1 / rpe.1: primitive-Int passed to the polymorphic +/// `print` helper. Pre-rpe.1 the fixture used `(do io/print_int n)` +/// directly and the iter-eob.1 "Term::Do args = Borrow" rule meant +/// zero RC traffic on the unboxed Int (allocs == 0, frees == 0). +/// Post-rpe.1, `print n` desugars through `Show Int.show` → +/// `int_to_str` (heap-Str alloc, `ret_mode: Own`) → `io/print_str` +/// → slab drops at scope close. Pin shifts to the new canonical +/// post-iter shape: exactly one heap-Str slab cycle per `print` +/// of a non-Str value. The let-binder property the original test +/// pinned (Term::Do args borrow-walk correctly on primitives) is +/// preserved by the surviving `io/print_str s` step inside +/// `print__Int.body`; this test now pins the slab-cycle pattern. #[test] fn int_arg_to_effect_op_does_not_rc_track() { let (stdout, allocs, frees, live) = build_and_run_with_rc_stats("int_to_print_int_borrow.ail"); assert_eq!(stdout, "7\n"); - assert_eq!(allocs, 0, "Int arg should not trigger any RC alloc; got allocs={allocs}"); - assert_eq!(frees, 0, "Int arg should not trigger any RC free; got frees={frees}"); + // Post-rpe.1: print n for n : Int allocates one heap-Str slab + // via Show Int → int_to_str, frees it at scope close. Spec §E. + assert_eq!(allocs, 1, "expected exactly one Show-Int heap-Str slab; got allocs={allocs}"); + assert_eq!(frees, 1, "expected exactly one free; got frees={frees}"); assert_eq!(live, 0, "no leaked RC slabs allowed; live={live}"); } diff --git a/crates/ail/tests/eq_ord_e2e.rs b/crates/ail/tests/eq_ord_e2e.rs index 5ae34af..1f87ccf 100644 --- a/crates/ail/tests/eq_ord_e2e.rs +++ b/crates/ail/tests/eq_ord_e2e.rs @@ -63,8 +63,9 @@ fn eq_ord_polymorphic_runs_end_to_end() { // Helper `at_most(3, 5)` at Int = true → 1 // `at_most(true, false)` at Bool = false → 0 // `at_most("abc", "abd")` at Str = true → 1 - // `io/print_int` emits one int per line, so stdout is "1\n0\n1" - // after `.trim()` strips the trailing newline. + // Polymorphic `print` for Int routes through `show` + `io/print_str`, + // emitting one int per line, so stdout is "1\n0\n1" after `.trim()` + // strips the trailing newline. assert_eq!(stdout, "1\n0\n1", "expected 1\\n0\\n1, got {stdout:?}"); } @@ -73,7 +74,7 @@ fn eq_ord_user_adt_runs_end_to_end() { let stdout = build_and_run("eq_ord_user_adt.ail"); // eq(MkIntBox 3, MkIntBox 3) = true → 1 // eq(MkIntBox 3, MkIntBox 5) = false → 0 - // `io/print_int` emits one int per line; trimmed stdout is "1\n0". + // Polymorphic `print` for Int emits one int per line; trimmed stdout is "1\n0". assert_eq!(stdout, "1\n0", "expected 1\\n0, got {stdout:?}"); } diff --git a/crates/ail/tests/floats_e2e.rs b/crates/ail/tests/floats_e2e.rs index fcebda0..c6a6522 100644 --- a/crates/ail/tests/floats_e2e.rs +++ b/crates/ail/tests/floats_e2e.rs @@ -4,8 +4,9 @@ //! CLI and run; stdout is matched against the expected three //! lines (`4`, `42`, `-1.5`). This test exercises the full //! pipeline — Float literal lowering, polymorphic `+` Float arm, -//! `int_to_float` (sitofp), `neg` Float (fneg), `io/print_float` -//! (printf `%g\n`). +//! `int_to_float` (sitofp), `neg` Float (fneg), and the polymorphic +//! `print` for Float (routes through `Show Float.show` → +//! `float_to_str`, libc `%g`). use std::path::PathBuf; use std::process::Command; diff --git a/crates/ail/tests/snapshots/list.ll b/crates/ail/tests/snapshots/list.ll index 4d9ece9..d03b612 100644 --- a/crates/ail/tests/snapshots/list.ll +++ b/crates/ail/tests/snapshots/list.ll @@ -2,8 +2,6 @@ source_filename = "list.ail" target triple = "" -@.str_list_fmt_int_0 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 - declare i32 @printf(ptr, ...) declare i32 @puts(ptr) declare ptr @GC_malloc(i64) @@ -19,6 +17,8 @@ declare i64 @llvm.fptosi.sat.i64.f64(double) @ail_list_sum_list_clos = private unnamed_addr constant { ptr, ptr } { ptr @ail_list_sum_list_adapter, ptr null } @ail_list_main_clos = private unnamed_addr constant { ptr, ptr } { ptr @ail_list_main_adapter, ptr null } +@ail_prelude_show__Int_clos = private unnamed_addr constant { ptr, ptr } { ptr @ail_prelude_show__Int_adapter, ptr null } +@ail_prelude_print__Int_clos = private unnamed_addr constant { ptr, ptr } { ptr @ail_prelude_print__Int_adapter, ptr null } define i64 @ail_list_sum_list(ptr %arg_xs) { entry: %v1 = load i64, ptr %arg_xs, align 8 @@ -72,8 +72,8 @@ entry: %v10 = getelementptr inbounds i8, ptr %v8, i64 16 store ptr %v5, ptr %v10, align 8 %v11 = call i64 @ail_list_sum_list(ptr %v8) - call i32 (ptr, ...) @printf(ptr @.str_list_fmt_int_0, i64 %v11) - ret i8 0 + %v12 = call i8 @ail_prelude_print__Int(i64 %v11) + ret i8 %v12 } define i8 @ail_list_main_adapter(ptr %_env) { @@ -82,6 +82,32 @@ entry: ret i8 %r } +define ptr @ail_prelude_show__Int(i64 %arg_x) { +entry: + %v1 = call ptr @ailang_int_to_str(i64 %arg_x) + ret ptr %v1 +} + +define ptr @ail_prelude_show__Int_adapter(ptr %_env, i64 %a0) { +entry: + %r = call ptr @ail_prelude_show__Int(i64 %a0) + ret ptr %r +} + +define i8 @ail_prelude_print__Int(i64 %arg_x) { +entry: + %v1 = call ptr @ail_prelude_show__Int(i64 %arg_x) + %v2 = getelementptr inbounds i8, ptr %v1, i64 8 + call i32 @puts(ptr %v2) + ret i8 0 +} + +define i8 @ail_prelude_print__Int_adapter(ptr %_env, i64 %a0) { +entry: + %r = call i8 @ail_prelude_print__Int(i64 %a0) + ret i8 %r +} + define i32 @main() { call i8 @ail_list_main() diff --git a/crates/ail/tests/snapshots/max3.ll b/crates/ail/tests/snapshots/max3.ll index b7be9f9..52adfa4 100644 --- a/crates/ail/tests/snapshots/max3.ll +++ b/crates/ail/tests/snapshots/max3.ll @@ -2,8 +2,6 @@ source_filename = "max3.ail" target triple = "" -@.str_max3_fmt_int_0 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 - declare i32 @printf(ptr, ...) declare i32 @puts(ptr) declare ptr @GC_malloc(i64) @@ -20,6 +18,8 @@ declare i64 @llvm.fptosi.sat.i64.f64(double) @ail_max3_max_clos = private unnamed_addr constant { ptr, ptr } { ptr @ail_max3_max_adapter, ptr null } @ail_max3_max3_clos = private unnamed_addr constant { ptr, ptr } { ptr @ail_max3_max3_adapter, ptr null } @ail_max3_main_clos = private unnamed_addr constant { ptr, ptr } { ptr @ail_max3_main_adapter, ptr null } +@ail_prelude_show__Int_clos = private unnamed_addr constant { ptr, ptr } { ptr @ail_prelude_show__Int_adapter, ptr null } +@ail_prelude_print__Int_clos = private unnamed_addr constant { ptr, ptr } { ptr @ail_prelude_print__Int_adapter, ptr null } define i64 @ail_max3_max(i64 %arg_a, i64 %arg_b) { entry: %v1 = icmp sgt i64 %arg_a, %arg_b @@ -77,8 +77,8 @@ entry: define i8 @ail_max3_main() { entry: %v1 = call i64 @ail_max3_max3(i64 3, i64 17, i64 9) - call i32 (ptr, ...) @printf(ptr @.str_max3_fmt_int_0, i64 %v1) - ret i8 0 + %v2 = call i8 @ail_prelude_print__Int(i64 %v1) + ret i8 %v2 } define i8 @ail_max3_main_adapter(ptr %_env) { @@ -87,6 +87,32 @@ entry: ret i8 %r } +define ptr @ail_prelude_show__Int(i64 %arg_x) { +entry: + %v1 = call ptr @ailang_int_to_str(i64 %arg_x) + ret ptr %v1 +} + +define ptr @ail_prelude_show__Int_adapter(ptr %_env, i64 %a0) { +entry: + %r = call ptr @ail_prelude_show__Int(i64 %a0) + ret ptr %r +} + +define i8 @ail_prelude_print__Int(i64 %arg_x) { +entry: + %v1 = call ptr @ail_prelude_show__Int(i64 %arg_x) + %v2 = getelementptr inbounds i8, ptr %v1, i64 8 + call i32 @puts(ptr %v2) + ret i8 0 +} + +define i8 @ail_prelude_print__Int_adapter(ptr %_env, i64 %a0) { +entry: + %r = call i8 @ail_prelude_print__Int(i64 %a0) + ret i8 %r +} + define i32 @main() { call i8 @ail_max3_main() diff --git a/crates/ail/tests/snapshots/sum.ll b/crates/ail/tests/snapshots/sum.ll index f2cfdf8..abea1e9 100644 --- a/crates/ail/tests/snapshots/sum.ll +++ b/crates/ail/tests/snapshots/sum.ll @@ -2,8 +2,6 @@ source_filename = "sum.ail" target triple = "" -@.str_sum_fmt_int_0 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 - declare i32 @printf(ptr, ...) declare i32 @puts(ptr) declare ptr @GC_malloc(i64) @@ -17,8 +15,36 @@ declare ptr @ailang_str_clone(ptr) declare ptr @ailang_str_concat(ptr, ptr) declare i64 @llvm.fptosi.sat.i64.f64(double) +@ail_prelude_show__Int_clos = private unnamed_addr constant { ptr, ptr } { ptr @ail_prelude_show__Int_adapter, ptr null } +@ail_prelude_print__Int_clos = private unnamed_addr constant { ptr, ptr } { ptr @ail_prelude_print__Int_adapter, ptr null } @ail_sum_sum_clos = private unnamed_addr constant { ptr, ptr } { ptr @ail_sum_sum_adapter, ptr null } @ail_sum_main_clos = private unnamed_addr constant { ptr, ptr } { ptr @ail_sum_main_adapter, ptr null } +define ptr @ail_prelude_show__Int(i64 %arg_x) { +entry: + %v1 = call ptr @ailang_int_to_str(i64 %arg_x) + ret ptr %v1 +} + +define ptr @ail_prelude_show__Int_adapter(ptr %_env, i64 %a0) { +entry: + %r = call ptr @ail_prelude_show__Int(i64 %a0) + ret ptr %r +} + +define i8 @ail_prelude_print__Int(i64 %arg_x) { +entry: + %v1 = call ptr @ail_prelude_show__Int(i64 %arg_x) + %v2 = getelementptr inbounds i8, ptr %v1, i64 8 + call i32 @puts(ptr %v2) + ret i8 0 +} + +define i8 @ail_prelude_print__Int_adapter(ptr %_env, i64 %a0) { +entry: + %r = call i8 @ail_prelude_print__Int(i64 %a0) + ret i8 %r +} + define i64 @ail_sum_sum(i64 %arg_n) { entry: %v1 = icmp eq i64 %arg_n, 0 @@ -44,8 +70,8 @@ entry: define i8 @ail_sum_main() { entry: %v1 = call i64 @ail_sum_sum(i64 10) - call i32 (ptr, ...) @printf(ptr @.str_sum_fmt_int_0, i64 %v1) - ret i8 0 + %v2 = call i8 @ail_prelude_print__Int(i64 %v1) + ret i8 %v2 } define i8 @ail_sum_main_adapter(ptr %_env) { diff --git a/crates/ail/tests/snapshots/ws_main.ll b/crates/ail/tests/snapshots/ws_main.ll index 256f571..75ec70f 100644 --- a/crates/ail/tests/snapshots/ws_main.ll +++ b/crates/ail/tests/snapshots/ws_main.ll @@ -2,8 +2,6 @@ source_filename = "ws_main.ail" target triple = "" -@.str_ws_main_fmt_int_0 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 - declare i32 @printf(ptr, ...) declare i32 @puts(ptr) declare ptr @GC_malloc(i64) @@ -17,8 +15,36 @@ declare ptr @ailang_str_clone(ptr) declare ptr @ailang_str_concat(ptr, ptr) declare i64 @llvm.fptosi.sat.i64.f64(double) +@ail_prelude_show__Int_clos = private unnamed_addr constant { ptr, ptr } { ptr @ail_prelude_show__Int_adapter, ptr null } +@ail_prelude_print__Int_clos = private unnamed_addr constant { ptr, ptr } { ptr @ail_prelude_print__Int_adapter, ptr null } @ail_ws_lib_add_clos = private unnamed_addr constant { ptr, ptr } { ptr @ail_ws_lib_add_adapter, ptr null } @ail_ws_main_main_clos = private unnamed_addr constant { ptr, ptr } { ptr @ail_ws_main_main_adapter, ptr null } +define ptr @ail_prelude_show__Int(i64 %arg_x) { +entry: + %v1 = call ptr @ailang_int_to_str(i64 %arg_x) + ret ptr %v1 +} + +define ptr @ail_prelude_show__Int_adapter(ptr %_env, i64 %a0) { +entry: + %r = call ptr @ail_prelude_show__Int(i64 %a0) + ret ptr %r +} + +define i8 @ail_prelude_print__Int(i64 %arg_x) { +entry: + %v1 = call ptr @ail_prelude_show__Int(i64 %arg_x) + %v2 = getelementptr inbounds i8, ptr %v1, i64 8 + call i32 @puts(ptr %v2) + ret i8 0 +} + +define i8 @ail_prelude_print__Int_adapter(ptr %_env, i64 %a0) { +entry: + %r = call i8 @ail_prelude_print__Int(i64 %a0) + ret i8 %r +} + define i64 @ail_ws_lib_add(i64 %arg_a, i64 %arg_b) { entry: %v1 = add i64 %arg_a, %arg_b @@ -34,8 +60,8 @@ entry: define i8 @ail_ws_main_main() { entry: %v1 = call i64 @ail_ws_lib_add(i64 2, i64 3) - call i32 (ptr, ...) @printf(ptr @.str_ws_main_fmt_int_0, i64 %v1) - ret i8 0 + %v2 = call i8 @ail_prelude_print__Int(i64 %v1) + ret i8 %v2 } define i8 @ail_ws_main_main_adapter(ptr %_env) { diff --git a/crates/ailang-check/src/builtins.rs b/crates/ailang-check/src/builtins.rs index 75d7cd0..fe95a5b 100644 --- a/crates/ailang-check/src/builtins.rs +++ b/crates/ailang-check/src/builtins.rs @@ -2,7 +2,7 @@ //! //! This module owns the **fixed** symbol set the language ships with — the //! arithmetic / comparison / logical operators (`+`, `==`, `not`, ...) and -//! the IO effect ops (`io/print_int`, ...). User code cannot define +//! the IO effect ops (`io/print_str`). User code cannot define //! anything in here; conversely the typechecker treats every entry as //! always-in-scope without an explicit import. //! @@ -37,7 +37,7 @@ pub struct EffectOpSig { /// `Term::Do { args }`. pub params: Vec, /// Return type of the op. Often [`Type::unit`] for sinks like - /// `io/print_int`. + /// `io/print_str`. pub ret: Type, } @@ -266,22 +266,6 @@ pub fn install(env: &mut crate::Env) { env.globals.insert("inf".into(), Type::float()); env.globals.insert("neg_inf".into(), Type::float()); - env.effect_ops.insert( - "io/print_int".into(), - EffectOpSig { - effect: "IO".into(), - params: vec![Type::int()], - ret: Type::unit(), - }, - ); - env.effect_ops.insert( - "io/print_bool".into(), - EffectOpSig { - effect: "IO".into(), - params: vec![Type::bool_()], - ret: Type::unit(), - }, - ); env.effect_ops.insert( "io/print_str".into(), EffectOpSig { @@ -290,16 +274,6 @@ pub fn install(env: &mut crate::Env) { ret: Type::unit(), }, ); - // Iter 22-floats.3: parallel to io/print_int|bool|str. Codegen - // lowers via runtime C glue `@ail_print_float` in iter 4. - env.effect_ops.insert( - "io/print_float".into(), - EffectOpSig { - effect: "IO".into(), - params: vec![Type::float()], - ret: Type::unit(), - }, - ); } /// Names of value-level built-ins (operators, `not`) — the ones that @@ -346,10 +320,7 @@ pub fn list() -> Vec<(&'static str, &'static str)> { ("nan", "Float"), ("inf", "Float"), ("neg_inf", "Float"), - ("io/print_int", "(Int) -> Unit !IO [effect op]"), - ("io/print_bool", "(Bool) -> Unit !IO [effect op]"), ("io/print_str", "(Str) -> Unit !IO [effect op]"), - ("io/print_float", "(Float) -> Unit !IO [effect op]"), ] } @@ -590,50 +561,6 @@ mod tests { assert_eq!(ty_neg_inf, Type::float(), "neg_inf must type as Float"); } - /// Iter 22-floats.3: `io/print_float : (Float) -> Unit !IO`. - /// Mirrors `io/print_int|bool|str`. Codegen lowering through runtime - /// C glue `@ail_print_float` lands in iter 4. Effects are collected - /// in the mutable `effects` sink (mirrors the real typechecker - /// pipeline); we assert both the return type and that `IO` was - /// accumulated. - #[test] - fn install_io_print_float_signature() { - let bits = 1.5_f64.to_bits(); - let mut env = Env::default(); - install(&mut env); - let do_term = Term::Do { - op: "io/print_float".into(), - args: vec![lit_float(bits)], - tail: false, - }; - let mut locals: IndexMap = IndexMap::new(); - let mut effects: BTreeSet = BTreeSet::new(); - let mut subst = Subst::default(); - let mut counter: u32 = 0; - let mut residuals = Vec::new(); - let mut free_fn_calls = Vec::new(); - let mut warnings: Vec = Vec::new(); - let ret = crate::synth( - &do_term, - &env, - &mut locals, - &mut effects, - "", - &mut subst, - &mut counter, - &mut residuals, - &mut free_fn_calls, - &mut warnings, - ) - .expect("synth"); - let ret = subst.apply(&ret); - assert_eq!(ret, Type::unit(), "io/print_float returns Unit"); - assert!( - effects.contains("IO"), - "io/print_float must accumulate IO effect, got {effects:?}" - ); - } - /// Iter 22-floats.3: pattern-matching on Float literals is hard- /// rejected at typecheck per spec line 723-735 recommendation (a). /// IEEE-`==` semantics make Float patterns semantically dubious diff --git a/crates/ailang-check/src/lib.rs b/crates/ailang-check/src/lib.rs index c5b6501..6fb4beb 100644 --- a/crates/ailang-check/src/lib.rs +++ b/crates/ailang-check/src/lib.rs @@ -3879,9 +3879,11 @@ mod tests { }, vec![], Term::Do { - op: "io/print_int".into(), + op: "io/print_str".into(), args: vec![Term::Lit { - lit: Literal::Int { value: 1 }, + lit: Literal::Str { + value: "hi".into(), + }, }], tail: false, }, @@ -5055,8 +5057,12 @@ mod tests { }, body: Term::Seq { lhs: Box::new(Term::Do { - op: "io/print_int".into(), - args: vec![Term::Var { name: "h".into() }], + op: "io/print_str".into(), + args: vec![Term::Lit { + lit: Literal::Str { + value: "x".into(), + }, + }], tail: false, }), rhs: Box::new(Term::App { diff --git a/crates/ailang-check/tests/no_per_type_print_ops.rs b/crates/ailang-check/tests/no_per_type_print_ops.rs new file mode 100644 index 0000000..875b090 --- /dev/null +++ b/crates/ailang-check/tests/no_per_type_print_ops.rs @@ -0,0 +1,41 @@ +//! Hard gate for iter rpe.1: the per-type print effect-ops +//! `io/print_int`, `io/print_bool`, `io/print_float` are retired +//! and must NOT appear in the builtin registry. The polymorphic +//! `print` helper (prelude, iter 24.3) is the canonical replacement; +//! `io/print_str` survives as the byte-channel primitive. + +use ailang_check::build_check_env; +use ailang_surface::load_workspace; +use std::path::PathBuf; + +fn fixture_dir() -> PathBuf { + let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + d.pop(); + d.pop(); + d.join("examples") +} + +#[test] +fn per_type_print_effect_ops_are_retired() { + // Any workspace will do; we only inspect the post-install + // builtin registry. `hello.ail` is the smallest surviving + // fixture (uses `io/print_str` only). + let ws_path = fixture_dir().join("hello.ail"); + let ws = load_workspace(&ws_path).expect("workspace loads"); + let env = build_check_env(&ws); + + for retired in ["io/print_int", "io/print_bool", "io/print_float"] { + assert!( + !env.effect_ops.contains_key(retired), + "{retired} must not appear in builtin registry post-rpe.1; \ + use polymorphic `print` (Show-based) instead" + ); + } + + // Survivor pin: io/print_str stays. + assert!( + env.effect_ops.contains_key("io/print_str"), + "io/print_str must survive — it is the canonical byte-channel \ + primitive and used internally by `print`" + ); +} diff --git a/crates/ailang-codegen/src/lib.rs b/crates/ailang-codegen/src/lib.rs index 6f14156..ba3d4a8 100644 --- a/crates/ailang-codegen/src/lib.rs +++ b/crates/ailang-codegen/src/lib.rs @@ -2299,50 +2299,6 @@ impl<'a> Emitter<'a> { let _ = tail; let call_kw = if tail { "tail call" } else { "call" }; match op { - "io/print_int" => { - if args.len() != 1 { - return Err(CodegenError::Internal( - "io/print_int arity".into(), - )); - } - let (v, vty) = self.lower_term(&args[0])?; - if vty != "i64" { - return Err(CodegenError::Internal( - "io/print_int needs i64".into(), - )); - } - let fmt = self.intern_string("fmt_int", "%lld\n"); - self.body.push_str(&format!( - " {call_kw} i32 (ptr, ...) @printf(ptr @{fmt}, i64 {v})\n" - )); - if tail { - self.body.push_str(" ret i8 0\n"); - self.block_terminated = true; - } - Ok(("0".into(), "i8".into())) - } - "io/print_float" => { - if args.len() != 1 { - return Err(CodegenError::Internal( - "io/print_float arity".into(), - )); - } - let (v, vty) = self.lower_term(&args[0])?; - if vty != "double" { - return Err(CodegenError::Internal( - "io/print_float needs double".into(), - )); - } - let fmt = self.intern_string("fmt_float", "%g\n"); - self.body.push_str(&format!( - " {call_kw} i32 (ptr, ...) @printf(ptr @{fmt}, double {v})\n" - )); - if tail { - self.body.push_str(" ret i8 0\n"); - self.block_terminated = true; - } - Ok(("0".into(), "i8".into())) - } "io/print_str" => { if args.len() != 1 { return Err(CodegenError::Internal( @@ -2370,45 +2326,6 @@ impl<'a> Emitter<'a> { } Ok(("0".into(), "i8".into())) } - "io/print_bool" => { - if args.len() != 1 { - return Err(CodegenError::Internal( - "io/print_bool arity".into(), - )); - } - let (v, vty) = self.lower_term(&args[0])?; - if vty != "i1" { - return Err(CodegenError::Internal( - "io/print_bool needs i1".into(), - )); - } - // Print "true\n" or "false\n". - let fmt_t = self.intern_string("fmt_true", "true\n"); - let fmt_f = self.intern_string("fmt_false", "false\n"); - let id = self.fresh_id(); - let then_lbl = format!("ptbl_t.{id}"); - let else_lbl = format!("ptbl_f.{id}"); - let join_lbl = format!("ptbl_j.{id}"); - self.body.push_str(&format!( - " br i1 {v}, label %{then_lbl}, label %{else_lbl}\n" - )); - self.start_block(&then_lbl); - self.body.push_str(&format!( - " call i32 (ptr, ...) @printf(ptr @{fmt_t})\n" - )); - self.body.push_str(&format!(" br label %{join_lbl}\n")); - self.start_block(&else_lbl); - self.body.push_str(&format!( - " call i32 (ptr, ...) @printf(ptr @{fmt_f})\n" - )); - self.body.push_str(&format!(" br label %{join_lbl}\n")); - self.start_block(&join_lbl); - if tail { - self.body.push_str(" ret i8 0\n"); - self.block_terminated = true; - } - Ok(("0".into(), "i8".into())) - } other => Err(CodegenError::Internal(format!( "unknown effect op: {other}" ))), @@ -2722,20 +2639,9 @@ impl<'a> Emitter<'a> { self.counter } - fn intern_string(&mut self, hint: &str, content: &str) -> String { - if let Some((name, _)) = self.strings.get(content) { - return name.clone(); - } - // Mangling per module: `.str___`. - let name = format!(".str_{}_{}_{}", self.module_name, hint, self.str_counter); - self.str_counter += 1; - let len = c_byte_len(content); - self.strings - .insert(content.to_string(), (name.clone(), len)); - name - } - - /// Iter hs.1 (amended hs.2): parallel to `intern_string`, but for + /// Iter hs.1 (amended hs.2): parallel to the legacy + /// `intern_string` (retired in iter rpe.1 alongside the per-type + /// print effect-ops it served), but for /// language `Str` literals emitted as packed-struct globals /// (len + bytes + NUL). Shares the same monotonic `str_counter` /// so the produced global names remain alphabetically orderable @@ -3577,45 +3483,6 @@ mod tests { assert!(ir.contains("0xFFF0000000000000"), "-inf bit pattern missing: {ir}"); } - /// Floats iter 4.6 RED: `(do io/print_float 1.5)` lowers via - /// `printf("%g\n", v)`, parallel to `io/print_int` at line 2152. - #[test] - fn lowers_io_print_float() { - use ailang_core::ast::*; - let body = Term::Do { - op: "io/print_float".into(), - args: vec![Term::Lit { lit: Literal::Float { bits: 0x3ff8_0000_0000_0000u64 } }], - tail: false, - }; - let m = Module { - schema: ailang_core::SCHEMA.to_string(), - name: "t".into(), - imports: vec![], - defs: vec![Def::Fn(FnDef { - name: "main".into(), - ty: Type::Fn { - params: vec![], ret: Box::new(Type::unit()), effects: vec!["IO".into()], - param_modes: vec![], ret_mode: ParamMode::Implicit, - }, - params: vec![], body, suppress: vec![], doc: None, - })], - }; - let ir = emit_ir(&m).unwrap(); - assert!( - ir.contains("call i32 (ptr, ...) @printf"), - "io/print_float not emitting printf: {ir}" - ); - assert!( - ir.contains("double 0x3FF8000000000000"), - "Float arg not threaded through io/print_float: {ir}" - ); - // Verify the format string `%g\n` is interned. - assert!( - ir.contains("%g") || ir.contains("\\67"), // `g` ASCII = 67 = 0x47 - "format string `%g\\n` not interned: {ir}" - ); - } - /// Iter 23.2: codegen intercepts a fn named `eq__Str` (the /// monomorphiser's synthesised symbol for `Eq Str.eq`) and emits /// a two-instruction body that calls @ail_str_eq, regardless of diff --git a/crates/ailang-codegen/src/synth.rs b/crates/ailang-codegen/src/synth.rs index a0ba28c..9185c16 100644 --- a/crates/ailang-codegen/src/synth.rs +++ b/crates/ailang-codegen/src/synth.rs @@ -212,7 +212,7 @@ pub(crate) fn builtin_ail_type(name: &str) -> Option { /// param signature is irrelevant here since we only consume the ret. pub(crate) fn builtin_effect_op_ret(op: &str) -> Option { Some(match op { - "io/print_int" | "io/print_bool" | "io/print_str" | "io/print_float" => Type::unit(), + "io/print_str" => Type::unit(), _ => return None, }) } diff --git a/crates/ailang-core/specs/form_a.md b/crates/ailang-core/specs/form_a.md index a0323bd..504e0ee 100644 --- a/crates/ailang-core/specs/form_a.md +++ b/crates/ailang-core/specs/form_a.md @@ -430,8 +430,8 @@ generating new code. (term-ctor List Cons 3 (term-ctor List Nil)))) (seq - (do io/print_int (app list_length xs)) - (do io/print_int (app sum_list xs))))))) + (app print (app list_length xs)) + (app print (app sum_list xs))))))) ``` ### 3 — `lit_pat.ail`: literal patterns and nested ctor patterns diff --git a/crates/ailang-core/tests/design_schema_drift.rs b/crates/ailang-core/tests/design_schema_drift.rs index 717aef4..c4b2b64 100644 --- a/crates/ailang-core/tests/design_schema_drift.rs +++ b/crates/ailang-core/tests/design_schema_drift.rs @@ -87,7 +87,7 @@ fn design_md_anchors_every_term_variant() { ( r#""t": "do""#, Term::Do { - op: "io/print_int".into(), + op: "io/print_str".into(), args: vec![], tail: false, }, diff --git a/crates/ailang-core/tests/hash_pin.rs b/crates/ailang-core/tests/hash_pin.rs index 2bc2608..c6aabc1 100644 --- a/crates/ailang-core/tests/hash_pin.rs +++ b/crates/ailang-core/tests/hash_pin.rs @@ -216,10 +216,13 @@ fn ct4_migrated_fixtures_have_canonical_form_hashes() { let ord_mod = ailang_surface::load_module(&examples.join("ordering_match.ail")) .expect("examples/ordering_match.ail loads"); let main_def = ord_mod.defs.iter().find(|d| d.name() == "main").unwrap(); + // Iter rpe.1 updated the hash: `ordering_match.ail`'s body migrated + // from `(do io/print_int x)` to `(app print x)` as part of the + // corpus migration retiring the per-type print effect-ops. assert_eq!( def_hash(main_def), - "8d17235aa3d2e127", - "ordering_match::main canonical hash must match captured post-migration value" + "b65a7f834703ffb4", + "ordering_match::main canonical hash must match captured post-rpe.1 value" ); let dup_a_mod = ailang_surface::load_module(&examples.join("test_22b1_dup_a.ail")) diff --git a/crates/ailang-core/tests/spec_drift.rs b/crates/ailang-core/tests/spec_drift.rs index f94e536..2b427e1 100644 --- a/crates/ailang-core/tests/spec_drift.rs +++ b/crates/ailang-core/tests/spec_drift.rs @@ -64,7 +64,7 @@ fn spec_mentions_every_term_variant() { ( "(do ", Term::Do { - op: "io/print_int".into(), + op: "io/print_str".into(), args: vec![], tail: false, }, diff --git a/crates/ailang-prose/src/lib.rs b/crates/ailang-prose/src/lib.rs index 963dfca..40c41b5 100644 --- a/crates/ailang-prose/src/lib.rs +++ b/crates/ailang-prose/src/lib.rs @@ -1585,11 +1585,15 @@ mod tests { #[test] fn do_renders_with_keyword_and_op() { let t = Term::Do { - op: "io/print_int".into(), - args: vec![Term::Lit { lit: Literal::Int { value: 5 } }], + op: "io/print_str".into(), + args: vec![Term::Lit { + lit: Literal::Str { + value: "5".into(), + }, + }], tail: false, }; - assert_eq!(render_term(&t), "do io/print_int(5)"); + assert_eq!(render_term(&t), "do io/print_str(\"5\")"); } // ---- Types ---- diff --git a/crates/ailang-surface/src/lex.rs b/crates/ailang-surface/src/lex.rs index 3d8f7be..deec5ab 100644 --- a/crates/ailang-surface/src/lex.rs +++ b/crates/ailang-surface/src/lex.rs @@ -16,7 +16,7 @@ //! - otherwise ⇒ ident. //! //! Operators (`+`, `==`, `<=`, `**`), qualified names like -//! `io/print_int`, and dotted cross-module references like +//! `io/print_str`, and dotted cross-module references like //! `std_list.map` are all single-token idents — there is no special //! lexical rule for any of them. `(`, `)`, and whitespace are the only //! reserved tokens. Bool literals (`true`, `false`) and unit @@ -317,7 +317,7 @@ mod tests { #[test] fn operators_are_idents() { - let toks = tokenize("+ == <= io/print_int std_list.map").unwrap(); + let toks = tokenize("+ == <= io/print_str std_list.map").unwrap(); let names: Vec<_> = toks .iter() .map(|t| match &t.tok { @@ -325,7 +325,7 @@ mod tests { _ => panic!("not ident"), }) .collect(); - assert_eq!(names, vec!["+", "==", "<=", "io/print_int", "std_list.map"]); + assert_eq!(names, vec!["+", "==", "<=", "io/print_str", "std_list.map"]); } #[test] diff --git a/crates/ailang-surface/src/parse.rs b/crates/ailang-surface/src/parse.rs index 131a08e..78c4cac 100644 --- a/crates/ailang-surface/src/parse.rs +++ b/crates/ailang-surface/src/parse.rs @@ -1374,7 +1374,7 @@ impl<'a> Parser<'a> { tail: bool, production: &'static str, ) -> Result { - let op = self.expect_ident("effect op (e.g. `io/print_int`)")?; + let op = self.expect_ident("effect op (e.g. `io/print_str`)")?; let mut args = Vec::new(); while !matches!(self.peek(), Some(Token { tok: Tok::RParen, .. })) { args.push(self.parse_term()?); diff --git a/docs/DESIGN.md b/docs/DESIGN.md index 5bd6375..b637cf3 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -328,7 +328,7 @@ Every other maximal token is classified post-hoc: - Otherwise → ident. Consequence: operators like `+`, `==`, `<=`, `**`, qualified -names like `io/print_int`, and cross-module references like +names like `io/print_str`, and cross-module references like `std_list.map` are all single ident tokens with no special lex rule. The only reserved tokens are `(`, `)`, and whitespace. Bool literals (`true`, `false`) and unit (`(lit-unit)`) are @@ -1987,9 +1987,10 @@ a => a -> () !IO` shipped in iter 24.3 with body `\x -> let s = show x in do io/print_str s` (explicit let-binder for heap-Str RC discipline per eob.1 Str carve-out). The let-binder is structurally pinned by `crates/ail/tests/print_mono_body_shape.rs`. -Routing through `print` replaces the ad-hoc `io/print_int|bool|float` -idiom for new code; retiring the per-type effect-ops is queued as a -P2 follow-up. +Routing through `print` replaces the ad-hoc per-type print +effect-ops; the `io/print_int`, `io/print_bool`, `io/print_float` +primitives were retired 2026-05-14 in iter rpe.1, leaving +`io/print_str` as the only surviving direct-output effect-op. ### Heap-Str primitives @@ -2021,8 +2022,12 @@ bodies dispatch into them. `str_concat` IS directly observable because the LLM-author calls it explicitly when authoring an instance body that wants to combine fragments. -Primitive output goes through `io/print_int` / `io/print_bool` / -`io/print_str` directly. +Primitive output for `Str` values goes through `io/print_str` +directly; values of other primitive types route through the +polymorphic `print` helper (§"Polymorphic print"), which feeds +the heap-Str result of `show x` into `io/print_str`. The per-type +effect-ops `io/print_int`, `io/print_bool`, `io/print_float` were +retired in iter rpe.1 (2026-05-14). `==`, `<`, `<=`, `>`, `>=` REMAIN primitive operators (unchanged from the original draft). Class methods are accessed by name (`eq x y`, @@ -2328,7 +2333,7 @@ are real surface forms. { "t": "if", "cond": Term, "then": Term, "else": Term } -// Effect-op invocation. `op` is "/" (e.g. "io/print_int"). +// Effect-op invocation. `op` is "/" (e.g. "io/print_str"). // `tail` triggers musttail (omitted when false). { "t": "do", "op": "/", "args": [Term...], "tail": false } @@ -2562,23 +2567,24 @@ no `f32` variant. The runtime / codegen contract: pattern is conformant; `0.0 / 0.0` may produce `0x7ff8000000000000` on one target and a different qNaN on another. -- The textual rendering of NaN by `io/print_float`. The libc - `printf("%g", nan)` glue used by the runtime is permitted to - emit `nan` / `-nan` / `NaN` etc. depending on libc version and - the NaN's sign bit; AILang does not normalise this, since the - prose / surface-print paths render NaN as the explicit `"NaN"` - spelling and `io/print_float` is for human-readable output, not - round-trip. +- The textual rendering of NaN through `float_to_str` (the runtime + C helper that backs `instance Show Float` and, post-iter-rpe.1, + every Float-typed `print` call). The libc `printf("%g", nan)` + glue used by `float_to_str` is permitted to emit `nan` / `-nan` + / `NaN` etc. depending on libc version and the NaN's sign bit; + AILang does not normalise this, since the prose / surface-print + paths render NaN as the explicit `"NaN"` spelling and Float + rendering is for human-readable output, not round-trip. The same libc-`%g` rendering applies to `show 1.5` / `show nan` / `show inf` via `instance Show Float` (which calls `float_to_str` internally — see §"Prelude (built-in) classes" for the Show ship). -The NaN-spelling caveat above is observable via both -`do io/print_float x` and `do print x` at the same `x`; the rendering -is libc-version-dependent and target-libc-specific. AILang does NOT -canonicalise Float textual representation; the LLM-author who needs -deterministic Float rendering for cross-platform test fixtures should -bypass `show` / `print` and emit a custom formatter. +The NaN-spelling caveat above is observable via `do print x` for +Float-typed `x`; the rendering is libc-version-dependent and +target-libc-specific. AILang does NOT canonicalise Float textual +representation; the LLM-author who needs deterministic Float +rendering for cross-platform test fixtures should bypass `show` / +`print` and emit a custom formatter. These are the Rust / Swift / standard-LLVM defaults — not research-grade reproducibility guarantees. The stronger guarantee @@ -2676,7 +2682,10 @@ What **is** supported (and used as the smoke test for the pipeline): - Int, Bool, Unit, **Str**, **Float** as primitive types. - `if`, `let`, function calls, recursion. - Effects on function signatures, with `do op(args)` for direct effect - ops (`io/print_int`, `io/print_bool`, `io/print_str`). + ops (`io/print_str`). The per-type print ops + `io/print_int`, `io/print_bool`, `io/print_float` were retired in + iter rpe.1; the polymorphic `print` (§"Polymorphic print") is the + canonical output path for non-Str values. - **Builtins.** Arithmetic operators (`+`, `-`, `*`, `/`) of type `forall a. (a, a) -> a` (codegen-restricted to `{Int, Float}`); `%` of type `(Int, Int) -> Int` (Int-only — `fmod` semantics for @@ -2696,7 +2705,7 @@ What **is** supported (and used as the smoke test for the pipeline): `fcmp uno`); Float bit-pattern constants `nan : Float`, `inf : Float`, `neg_inf : Float` (resolved as bare values, lower to direct hex-float `double` SSA constants at use site); the IO - effect ops (`io/print_int|bool|str|float`); **`==` : forall a. + effect op `io/print_str`; **`==` : forall a. (a, a) -> Bool**; and **`__unreachable__ : forall a. a`**. - **`==` is polymorphic.** The typechecker accepts `==` at any type whose two sides agree (the rigid `a` of the diff --git a/docs/journals/2026-05-14-iter-rpe.1.md b/docs/journals/2026-05-14-iter-rpe.1.md new file mode 100644 index 0000000..23c4cdb --- /dev/null +++ b/docs/journals/2026-05-14-iter-rpe.1.md @@ -0,0 +1,175 @@ +# iter rpe.1 — Retire per-type print effect-ops + +**Date:** 2026-05-14 +**Started from:** 8b455bee4ca2b09bcadc56d95e0d79dcef75d284 +**Status:** DONE +**Tasks completed:** 10 of 10 + +## Summary + +The retire-per-type-print-effect-ops milestone shipped in one iter, +covering: a RED test pinning the deletion gate (`crates/ailang-check/ +tests/no_per_type_print_ops.rs`); 92 `examples/*.ail` fixture +migrations from `(do io/print_ x)` → `(app print x)` plus 6 +`.prose.txt` snapshot regenerations; four-site lockstep compiler +deletion (`crates/ailang-check/src/builtins.rs` × 5 regions, +`crates/ailang-codegen/src/lib.rs::lower_app` × 3 arms + 1 test, +`crates/ailang-codegen/src/synth.rs::builtin_effect_op_ret` × 1 +match arm), with the dead `intern_string` helper removed as a +clean follow-up; six test-body migrations (`ailang-check` × 2, +`ailang-core` tests × 2, `ailang-surface/src/lex.rs`, `ailang-prose`); +the Cat B test-harness patch in `crates/ail/tests/e2e.rs` (6 +IR-shape tests gained a `monomorphise_workspace` call so they +follow the same desugar → lift → mono → lower pipeline as `ail +build`); 6 doc-comment touch-ups; 7-site DESIGN.md sweep; 3 E2E +test-comment polish; bench-run-and-no-ratification (all 3 scripts +exit 0 against existing baselines, drift envelope within +tolerance); plus IR-snapshot refresh (4 `.ll` files: `sum`, +`list`, `max3`, `ws_main`) and 1 canonical-hash pin update +(`ordering_match::main`) as plan-unanticipated downstream +consequences of the corpus migration. Tests 564/564 green +post-iter (was 563 at start; +1 from the new RED test). + +## Per-task notes + +- iter rpe.1.1: RED test `no_per_type_print_ops.rs` — asserts + `io/print_int|bool|float` absent from `env.effect_ops`, + `io/print_str` present. +- iter rpe.1.2: 92 `.ail` corpus migrated (89 single-line + + 3 multi-line shapes); 5 ancillary comment touch-ups in + `borrow_own_demo`, `eq_demo`, `int_to_print_int_borrow`, + `floats_1_newton_sqrt`, `floats_3_safe_division` to satisfy + the §H acceptance criterion `grep -rl ... examples/ == 0`. +- iter rpe.1.3: 6 `.prose.txt` snapshots regenerated via + `cargo run -p ail -- prose`. +- iter rpe.1.4: builtins.rs deletes (3 effect_ops.insert blocks + + 3 `list()` rows + 1 unit test + 2 doc-comment swaps); + codegen lib.rs deletes (3 `lower_app` arms + 1 test); + synth.rs `builtin_effect_op_ret` match-arm narrowed. + `intern_string` removed as orphan helper. `Emitter.strings` + field left in place (still consumed by emit-time loop; + cycles over empty map; non-functional). RED test flips + GREEN. +- iter rpe.1.5: 6 test-body sites swapped to `io/print_str` + + `Str` args; Cat B harness patch at all 6 e2e.rs sites + inserts `ailang_check::monomorphise_workspace(&lifted_ws)` + between the existing lift loop and the lower call (the plan + said "replace the desugar+lift loop with mono", but mono's + precondition is "already lifted" — interpreting per spirit + and matching the `ail build` pipeline). E2E 85/85 green + after this step. +- iter rpe.1.6: doc-comment swaps in 6 sites (`lex.rs`, + `parse.rs`, `main.rs` × 2, `runtime/str.c`, `form_a.md`). +- iter rpe.1.7: DESIGN.md 7 sites swept; the iter's + past-tense paragraph at line 1990-1992 anchors the + milestone close. +- iter rpe.1.8: E2E test-comment polish at `eq_ord_e2e.rs` × 2, + `floats_e2e.rs`. Plus three plan-unanticipated sites: + `int_arg_to_effect_op_does_not_rc_track` test assertions + shifted from `0/0/0` to `1/1/0` (post-iter `print n` for + Int now goes via Show Int → int_to_str → io/print_str, + exactly one heap-Str slab cycle per spec §E); 4 IR + snapshots refreshed via `UPDATE_SNAPSHOTS=1` because the + format-string globals (`@.str__fmt_int_0` / + `%lld\n`) no longer appear in IR; 1 canonical-hash pin + update for `ordering_match::main` (body migration changes + the def's canonical-form hash). +- iter rpe.1.9: bench run — all 3 scripts exit 0 against + existing baselines. No ratification needed; spec §C4 (a) + anticipated possible latency drift but actual fell within + tolerance. Largest single deltas: `latency.explicit_at_rc. + max_us` +154.84% (a tail metric in the noise-class + envelope observed across the last ~12 audits); `throughput. + bench_list_sum.bump_s` +11.85% (REGRESSION, single bench, + 3rd-iter-recurring; tracked as background noise per + audit-24 lineage). Baseline pristine for the 13th + consecutive audit-equivalent. +- iter rpe.1.10: roadmap entry struck `[x]`; journal written; + stats written. + +## Concerns + +- Cat B harness patch deviates from plan-literal: plan said + "replace the desugar+lift loop with monomorphise_workspace"; + I inserted mono after the existing lift loop. Mono's + documented precondition is "already lifted", so the literal + reading would have broken mono's contract. Spirit-reading + was unambiguous: match `ail build`'s pipeline. +- Plan Task 8 under-scoped: it named 3 E2E-comment sites, + but the corpus migration also forced (a) one assertion + update on `int_arg_to_effect_op_does_not_rc_track` (allocs + 0→1, frees 0→1, fully documented in spec §E), (b) IR + snapshot refresh × 4, (c) one canonical-hash pin update. + All three are mechanical downstream consequences of Task 2. +- `Emitter.strings` field in `crates/ailang-codegen/src/lib.rs` + is now functionally dead (no caller after `intern_string` + removal) but the field + the per-module collection loop + + the emit-time globals loop are all still in place. They + cycle over an empty map and are harmless. Cleaning them + up cascades through `emit_workspace_with_alloc` and + parallel `str_literals` infrastructure; out of scope for + this iter. + +## Known debt + +- The `int_arg_to_effect_op_does_not_rc_track` test name now + describes a pre-iter property; the body pins the post-iter + shape (one Show-Int slab cycle). Renaming to e.g. + `print_int_one_slab_cycle` was floated and explicitly + declined (plan Task 8 step 2 said "lean toward keep-name- + update-doc"). If a future iter wants the rename, the test + body is already a clean reference. +- The `intern_string` helper is gone but `Emitter.strings` + field remains — see Concerns above. + +## Files touched + +121 files in the working tree (1 new + 120 modified). + +Code (compiler): +- `crates/ailang-check/src/builtins.rs` (3 effect_ops + 3 list() rows + 1 test + 2 doc-comments deleted/swapped) +- `crates/ailang-check/src/lib.rs` (2 test-body sites swapped) +- `crates/ailang-codegen/src/lib.rs` (3 lower_app arms + 1 test + `intern_string` helper removed) +- `crates/ailang-codegen/src/synth.rs` (builtin_effect_op_ret match-arm narrowed) +- `crates/ailang-surface/src/lex.rs` (1 test-body + 1 module doc swap) +- `crates/ailang-surface/src/parse.rs` (1 diagnostic example swap) +- `crates/ailang-prose/src/lib.rs` (1 round-trip test-body swap) +- `crates/ail/src/main.rs` (2 doc-comments swapped) +- `runtime/str.c` (1 comment re-anchored on %g) + +Tests: +- `crates/ailang-check/tests/no_per_type_print_ops.rs` (NEW) +- `crates/ailang-core/tests/spec_drift.rs` (1 swap) +- `crates/ailang-core/tests/design_schema_drift.rs` (1 swap) +- `crates/ailang-core/tests/hash_pin.rs` (1 hash pin updated) +- `crates/ail/tests/e2e.rs` (6 Cat B harness patches + 1 assertion update + 1 doc-comment) +- `crates/ail/tests/eq_ord_e2e.rs` (2 doc-comments) +- `crates/ail/tests/floats_e2e.rs` (1 doc-comment) +- `crates/ail/tests/snapshots/{sum,list,max3,ws_main}.ll` (regenerated; format-string globals removed) + +Docs: +- `docs/DESIGN.md` (7 sites) +- `docs/roadmap.md` (P2 entry struck [x]) +- `crates/ailang-core/specs/form_a.md` (1 example swap) + +Examples: 92 `.ail` migrations + 6 `.prose.txt` regenerations + 5 ancillary comment touch-ups. + +## Verification + +- `cargo test --workspace`: 564 passed, 0 failed (was 563 at + start; +1 = new RED test, no test counts shifted otherwise). +- `cargo build --workspace`: clean. +- `python3 bench/check.py` exit 0 (drift within tolerance, + no ratification). +- `python3 bench/compile_check.py` exit 0. +- `python3 bench/cross_lang.py` exit 0 (25/25 stable). +- `grep -rl "io/print_int\|io/print_bool\|io/print_float" + examples/` returns 0 results (acceptance criterion met). +- `grep -n "io/print_int\|io/print_bool\|io/print_float" + crates/ailang-check/src/builtins.rs` returns 0 lines. +- `crates/ailang-codegen/src/lib.rs::lower_app` has no arm + for any of the three retired op names. + +## Stats + +`bench/orchestrator-stats/2026-05-14-iter-rpe.1.json` diff --git a/docs/roadmap.md b/docs/roadmap.md index 82920f2..f65aed8 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -77,17 +77,10 @@ context. Pick the next milestone from P1.)_ ## P2 — Medium-term -- [ ] **\[milestone\]** Retire `io/print_int` / `io/print_bool` / +- [x] **\[milestone\]** Retire `io/print_int` / `io/print_bool` / `io/print_float` effect-ops + migrate example corpus to `print`. - Bulk text substitution `do io/print_ x` → `do print x` across - `examples/*.ail.json` (~86 fixtures affected). Per-type effect-ops - are deleted from `crates/ailang-check/src/builtins.rs`, - `crates/ailang-codegen/src/lib.rs::lower_app` arms, and the - corresponding runtime C glue. - - context: post-milestone-24 mechanical follow-up; the architecture- - shipping milestone (24) and corpus-migration milestone (this) are - separate so migration runs against a frozen architecture. Same - call milestone 23 made for `==` / `eq`. + Shipped 2026-05-14 as iter rpe.1. + - context: per-iter journal `docs/journals/2026-05-14-iter-rpe.1.md`. - [x] **\[todo\]** Author `examples/prelude.ail` alongside `examples/prelude.ail.json`. (Satisfied 2026-05-13 by iter diff --git a/examples/bench_closure_chain.ail b/examples/bench_closure_chain.ail index 38fe91f..d59875a 100644 --- a/examples/bench_closure_chain.ail +++ b/examples/bench_closure_chain.ail @@ -63,6 +63,6 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_int (app run 10000)) - (seq (do io/print_int (app run 100000)) - (do io/print_int (app run 500000))))))) + (seq (app print (app run 10000)) + (seq (app print (app run 100000)) + (app print (app run 500000))))))) diff --git a/examples/bench_compute_collatz.ail b/examples/bench_compute_collatz.ail index 511090c..fcfecb1 100644 --- a/examples/bench_compute_collatz.ail +++ b/examples/bench_compute_collatz.ail @@ -54,7 +54,7 @@ (fn run_one (type (fn-type (params (con Int)) (ret (con Unit)) (effects IO))) (params n) - (body (do io/print_int (app sum_steps_loop n 0)))) + (body (app print (app sum_steps_loop n 0)))) (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) diff --git a/examples/bench_compute_intsum.ail b/examples/bench_compute_intsum.ail index 149d9fe..2c97f2b 100644 --- a/examples/bench_compute_intsum.ail +++ b/examples/bench_compute_intsum.ail @@ -37,7 +37,7 @@ (fn run_one (type (fn-type (params (con Int)) (ret (con Unit)) (effects IO))) (params n) - (body (do io/print_int (app intsum_loop n 0)))) + (body (app print (app intsum_loop n 0)))) (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) diff --git a/examples/bench_hof_pipeline.ail b/examples/bench_hof_pipeline.ail index 752a4d1..460db7f 100644 --- a/examples/bench_hof_pipeline.ail +++ b/examples/bench_hof_pipeline.ail @@ -73,7 +73,7 @@ (type (fn-type (params (con Int)) (ret (con Unit)) (effects IO))) (params n) (body - (do io/print_int + (app print (app fold_with_fn inc (app build_n n (term-ctor List Nil)) 0)))) diff --git a/examples/bench_latency_explicit.ail b/examples/bench_latency_explicit.ail index 4f40ae0..79d712a 100644 --- a/examples/bench_latency_explicit.ail +++ b/examples/bench_latency_explicit.ail @@ -139,10 +139,10 @@ (params remaining print_countdown chunk_len print_k t) (body (if (app == remaining 0) - (do io/print_int 9999) + (app print 9999) (if (app == print_countdown 0) (seq - (do io/print_int (app one_op chunk_len t)) + (app print (app one_op chunk_len t)) (tail-app loop (app - remaining 1) (app - print_k 1) @@ -165,5 +165,5 @@ (let t (app build_tree 19) (let _root (app pin_root t) (seq - (do io/print_int 8888) + (app print 8888) (app loop 20000 0 500 20 t))))))) diff --git a/examples/bench_latency_implicit.ail b/examples/bench_latency_implicit.ail index 8a810b3..a452757 100644 --- a/examples/bench_latency_implicit.ail +++ b/examples/bench_latency_implicit.ail @@ -195,10 +195,10 @@ (params remaining print_countdown chunk_len print_k t) (body (if (app == remaining 0) - (do io/print_int 9999) + (app print 9999) (if (app == print_countdown 0) (seq - (do io/print_int (app one_op chunk_len t)) + (app print (app one_op chunk_len t)) (tail-app loop (app - remaining 1) (app - print_k 1) @@ -221,5 +221,5 @@ (let t (app build_tree 19) (let _root (app pin_root t) (seq - (do io/print_int 8888) + (app print 8888) (app loop 20000 0 500 20 t))))))) diff --git a/examples/bench_list_sum.ail b/examples/bench_list_sum.ail index 21f9e97..96ac91e 100644 --- a/examples/bench_list_sum.ail +++ b/examples/bench_list_sum.ail @@ -88,7 +88,7 @@ (type (fn-type (params (con Int)) (ret (con Unit)) (effects IO))) (params n) (body - (do io/print_int (app sum_list (app cons_n n))))) + (app print (app sum_list (app cons_n n))))) (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) diff --git a/examples/bench_list_sum.prose.txt b/examples/bench_list_sum.prose.txt index 5385f74..fd39099 100644 --- a/examples/bench_list_sum.prose.txt +++ b/examples/bench_list_sum.prose.txt @@ -31,7 +31,7 @@ fn sum_list(xs: IntList) -> Int { /// Build a list of length n, sum it, print the sum. fn run_one(n: Int) -> Unit with IO { - do io/print_int(sum_list(cons_n(n))) + print(sum_list(cons_n(n))) } fn main() -> Unit with IO { diff --git a/examples/bench_list_sum_explicit.ail b/examples/bench_list_sum_explicit.ail index 39a5853..cf9a178 100644 --- a/examples/bench_list_sum_explicit.ail +++ b/examples/bench_list_sum_explicit.ail @@ -83,7 +83,7 @@ (type (fn-type (params (con Int)) (ret (con Unit)) (effects IO))) (params n) (body - (do io/print_int (app sum_list (app cons_n n))))) + (app print (app sum_list (app cons_n n))))) (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) diff --git a/examples/bench_mono_dispatch.ail b/examples/bench_mono_dispatch.ail index e1f7b49..fdc6058 100644 --- a/examples/bench_mono_dispatch.ail +++ b/examples/bench_mono_dispatch.ail @@ -20,4 +20,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (app loop_call 100000000 0))))) + (body (app print (app loop_call 100000000 0))))) diff --git a/examples/bench_tree_walk.ail b/examples/bench_tree_walk.ail index 5ca0124..f4084a3 100644 --- a/examples/bench_tree_walk.ail +++ b/examples/bench_tree_walk.ail @@ -67,7 +67,7 @@ (type (fn-type (params (con Int)) (ret (con Unit)) (effects IO))) (params depth) (body - (do io/print_int (app sum_tree (app build_tree depth))))) + (app print (app sum_tree (app build_tree depth))))) (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) diff --git a/examples/borrow_own_demo.ail b/examples/borrow_own_demo.ail index 4fed93d..67579c7 100644 --- a/examples/borrow_own_demo.ail +++ b/examples/borrow_own_demo.ail @@ -12,7 +12,7 @@ ; (borrow (con List)) — list_length's xs parameter ; (own (con List)) — sum_list's xs parameter ; -; Expected stdout (one int per line, via io/print_int + a newline): +; Expected stdout (one int per line, via polymorphic `print` + a newline): ; 3 ; 6 @@ -60,5 +60,5 @@ (term-ctor List Cons 3 (term-ctor List Nil)))) (seq - (do io/print_int (app list_length xs)) - (do io/print_int (app sum_list xs))))))) + (app print (app list_length xs)) + (app print (app sum_list xs))))))) diff --git a/examples/box.ail b/examples/box.ail index df1493b..5d83ab8 100644 --- a/examples/box.ail +++ b/examples/box.ail @@ -31,6 +31,6 @@ (effects IO))) (params) (body - (do io/print_int + (app print (app unbox (term-ctor Box MkBox 42)))))) diff --git a/examples/clone_demo.ail b/examples/clone_demo.ail index b72b003..23efba3 100644 --- a/examples/clone_demo.ail +++ b/examples/clone_demo.ail @@ -23,4 +23,4 @@ (params) (body (let x 42 - (do io/print_int (clone x)))))) + (app print (clone x)))))) diff --git a/examples/closure.ail b/examples/closure.ail index f45c9f6..9452b27 100644 --- a/examples/closure.ail +++ b/examples/closure.ail @@ -8,4 +8,4 @@ (doc "captures `n` from the enclosing let, returns 42") (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (let n 3 (do io/print_int (app apply (lam (params (typed x (con Int))) (ret (con Int)) (body (app + x n))) 39)))))) + (body (let n 3 (app print (app apply (lam (params (typed x (con Int))) (ret (con Int)) (body (app + x n))) 39)))))) diff --git a/examples/cmp_max_smoke.ail b/examples/cmp_max_smoke.ail index 3d78897..6adb4fb 100644 --- a/examples/cmp_max_smoke.ail +++ b/examples/cmp_max_smoke.ail @@ -8,4 +8,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (app cmp_max 3 7))))) + (body (app print (app cmp_max 3 7))))) diff --git a/examples/compare_primitives_smoke.ail b/examples/compare_primitives_smoke.ail index 6ba562c..decc247 100644 --- a/examples/compare_primitives_smoke.ail +++ b/examples/compare_primitives_smoke.ail @@ -2,31 +2,31 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (seq (do io/print_int (match (app compare 1 2) + (body (seq (app print (match (app compare 1 2) (case (pat-ctor LT) 1) (case (pat-ctor EQ) 2) - (case (pat-ctor GT) 3))) (seq (do io/print_int (match (app compare 1 1) + (case (pat-ctor GT) 3))) (seq (app print (match (app compare 1 1) (case (pat-ctor LT) 1) (case (pat-ctor EQ) 2) - (case (pat-ctor GT) 3))) (seq (do io/print_int (match (app compare 2 1) + (case (pat-ctor GT) 3))) (seq (app print (match (app compare 2 1) (case (pat-ctor LT) 1) (case (pat-ctor EQ) 2) - (case (pat-ctor GT) 3))) (seq (do io/print_int (match (app compare false true) + (case (pat-ctor GT) 3))) (seq (app print (match (app compare false true) (case (pat-ctor LT) 1) (case (pat-ctor EQ) 2) - (case (pat-ctor GT) 3))) (seq (do io/print_int (match (app compare false false) + (case (pat-ctor GT) 3))) (seq (app print (match (app compare false false) (case (pat-ctor LT) 1) (case (pat-ctor EQ) 2) - (case (pat-ctor GT) 3))) (seq (do io/print_int (match (app compare true false) + (case (pat-ctor GT) 3))) (seq (app print (match (app compare true false) (case (pat-ctor LT) 1) (case (pat-ctor EQ) 2) - (case (pat-ctor GT) 3))) (seq (do io/print_int (match (app compare "a" "b") + (case (pat-ctor GT) 3))) (seq (app print (match (app compare "a" "b") (case (pat-ctor LT) 1) (case (pat-ctor EQ) 2) - (case (pat-ctor GT) 3))) (seq (do io/print_int (match (app compare "a" "a") + (case (pat-ctor GT) 3))) (seq (app print (match (app compare "a" "a") (case (pat-ctor LT) 1) (case (pat-ctor EQ) 2) - (case (pat-ctor GT) 3))) (do io/print_int (match (app compare "b" "a") + (case (pat-ctor GT) 3))) (app print (match (app compare "b" "a") (case (pat-ctor LT) 1) (case (pat-ctor EQ) 2) (case (pat-ctor GT) 3)))))))))))))) diff --git a/examples/ct_1_ordering_signum.ail b/examples/ct_1_ordering_signum.ail index 0c5f398..64db681 100644 --- a/examples/ct_1_ordering_signum.ail +++ b/examples/ct_1_ordering_signum.ail @@ -39,7 +39,7 @@ (match xs (case (pat-ctor INil) (lit-unit)) (case (pat-ctor ICons h t) - (seq (do io/print_int (app signum h)) + (seq (app print (app signum h)) (tail-app drain t)))))) (fn main diff --git a/examples/ct_2_bare_cross_module.ail b/examples/ct_2_bare_cross_module.ail index a43f5dc..27bf43a 100644 --- a/examples/ct_2_bare_cross_module.ail +++ b/examples/ct_2_bare_cross_module.ail @@ -28,4 +28,4 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (do io/print_int (app std_maybe.from_maybe 99 (app classify (term-ctor std_maybe.Maybe Just 7))))))) + (app print (app std_maybe.from_maybe 99 (app classify (term-ctor std_maybe.Maybe Just 7))))))) diff --git a/examples/eq_demo.ail b/examples/eq_demo.ail index 8ba6f86..731abb9 100644 --- a/examples/eq_demo.ail +++ b/examples/eq_demo.ail @@ -25,7 +25,7 @@ ; 2 ; classify_str "ho" (lit-pattern hits 2 arm) ; 0 ; classify_str "??" (default arm) ; -; Driver lowers via io/print_bool / io/print_int. +; Driver routes through the polymorphic `print` helper (Show Bool / Show Int). (module eq_demo @@ -44,13 +44,13 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_bool (app == 5 5)) - (seq (do io/print_bool (app == 5 6)) - (seq (do io/print_bool (app == true false)) - (seq (do io/print_bool (app == true true)) - (seq (do io/print_bool (app == "hi" "hi")) - (seq (do io/print_bool (app == "hi" "ho")) - (seq (do io/print_bool (app == (lit-unit) (lit-unit))) - (seq (do io/print_int (app classify_str "hi")) - (seq (do io/print_int (app classify_str "ho")) - (do io/print_int (app classify_str "??")))))))))))))) + (seq (app print (app == 5 5)) + (seq (app print (app == 5 6)) + (seq (app print (app == true false)) + (seq (app print (app == true true)) + (seq (app print (app == "hi" "hi")) + (seq (app print (app == "hi" "ho")) + (seq (app print (app == (lit-unit) (lit-unit))) + (seq (app print (app classify_str "hi")) + (seq (app print (app classify_str "ho")) + (app print (app classify_str "??")))))))))))))) diff --git a/examples/eq_float_noinstance.ail b/examples/eq_float_noinstance.ail index 51791a2..5085292 100644 --- a/examples/eq_float_noinstance.ail +++ b/examples/eq_float_noinstance.ail @@ -2,4 +2,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (if (app eq 1.0 2.0) 1 0))))) + (body (app print (if (app eq 1.0 2.0) 1 0))))) diff --git a/examples/eq_ord_polymorphic.ail b/examples/eq_ord_polymorphic.ail index 51b31c3..4cde39f 100644 --- a/examples/eq_ord_polymorphic.ail +++ b/examples/eq_ord_polymorphic.ail @@ -7,4 +7,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (seq (do io/print_int (if (app at_most 3 5) 1 0)) (seq (do io/print_int (if (app at_most true false) 1 0)) (do io/print_int (if (app at_most "abc" "abd") 1 0))))))) + (body (seq (app print (if (app at_most 3 5) 1 0)) (seq (app print (if (app at_most true false) 1 0)) (app print (if (app at_most "abc" "abd") 1 0))))))) diff --git a/examples/eq_ord_user_adt.ail b/examples/eq_ord_user_adt.ail index b2b7eeb..f0590c0 100644 --- a/examples/eq_ord_user_adt.ail +++ b/examples/eq_ord_user_adt.ail @@ -21,4 +21,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (seq (do io/print_int (if (app eq (term-ctor IntBox MkIntBox 3) (term-ctor IntBox MkIntBox 3)) 1 0)) (do io/print_int (if (app eq (term-ctor IntBox MkIntBox 3) (term-ctor IntBox MkIntBox 5)) 1 0)))))) + (body (seq (app print (if (app eq (term-ctor IntBox MkIntBox 3) (term-ctor IntBox MkIntBox 3)) 1 0)) (app print (if (app eq (term-ctor IntBox MkIntBox 3) (term-ctor IntBox MkIntBox 5)) 1 0)))))) diff --git a/examples/eq_primitives_smoke.ail b/examples/eq_primitives_smoke.ail index 3e50361..f9db923 100644 --- a/examples/eq_primitives_smoke.ail +++ b/examples/eq_primitives_smoke.ail @@ -7,4 +7,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (seq (do io/print_int (app to_int (app eq 7 7))) (seq (do io/print_int (app to_int (app eq 7 8))) (seq (do io/print_int (app to_int (app eq true true))) (seq (do io/print_int (app to_int (app eq true false))) (seq (do io/print_int (app to_int (app eq "hello" "hello"))) (do io/print_int (app to_int (app eq "hello" "world"))))))))))) + (body (seq (app print (app to_int (app eq 7 7))) (seq (app print (app to_int (app eq 7 8))) (seq (app print (app to_int (app eq true true))) (seq (app print (app to_int (app eq true false))) (seq (app print (app to_int (app eq "hello" "hello"))) (app print (app to_int (app eq "hello" "world"))))))))))) diff --git a/examples/escape_local_demo.ail b/examples/escape_local_demo.ail index 4e79c1a..d1266a1 100644 --- a/examples/escape_local_demo.ail +++ b/examples/escape_local_demo.ail @@ -51,7 +51,7 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_int (app peek 0)) - (seq (do io/print_int (app peek 123)) - (seq (do io/print_int (app count 5)) - (do io/print_int (app count 0)))))))) + (seq (app print (app peek 0)) + (seq (app print (app peek 123)) + (seq (app print (app count 5)) + (app print (app count 0)))))))) diff --git a/examples/fieldtest/floats_1_newton_sqrt.ail b/examples/fieldtest/floats_1_newton_sqrt.ail index 1d11b27..8d1206a 100644 --- a/examples/fieldtest/floats_1_newton_sqrt.ail +++ b/examples/fieldtest/floats_1_newton_sqrt.ail @@ -6,7 +6,7 @@ ; sqrt(2.0). Expected stdout (one line): approximately 1.41421356... ; ; Exercises: Float literals, polymorphic +, *, /, recursion with -; Float-typed accumulator, io/print_float. +; Float-typed accumulator, polymorphic `print` (Show Float). (module floats_1_newton_sqrt @@ -35,4 +35,4 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (do io/print_float (app sqrt 2.0))))) + (app print (app sqrt 2.0))))) diff --git a/examples/fieldtest/floats_2_average_int_list.ail b/examples/fieldtest/floats_2_average_int_list.ail index 95d0517..cf533bc 100644 --- a/examples/fieldtest/floats_2_average_int_list.ail +++ b/examples/fieldtest/floats_2_average_int_list.ail @@ -57,7 +57,7 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (do io/print_float + (app print (app mean (term-ctor IntList Cons 1 (term-ctor IntList Cons 2 diff --git a/examples/fieldtest/floats_3_safe_division.ail b/examples/fieldtest/floats_3_safe_division.ail index 29512e0..3cfa1ba 100644 --- a/examples/fieldtest/floats_3_safe_division.ail +++ b/examples/fieldtest/floats_3_safe_division.ail @@ -26,7 +26,7 @@ ; nan ; 0/0 ; -1 ; classify(0/0) -> NaN ; -; (`io/print_float` prints "%g\n", so inf prints as "inf", NaN as "nan".) +; (`print` for Float routes through `float_to_str`, which uses "%g", so inf prints as "inf", NaN as "nan".) (module floats_3_safe_division @@ -47,9 +47,9 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_float (app / 6.0 3.0)) - (seq (do io/print_int (app classify (app / 6.0 3.0))) - (seq (do io/print_float (app / 1.0 0.0)) - (seq (do io/print_int (app classify (app / 1.0 0.0))) - (seq (do io/print_float (app / 0.0 0.0)) - (do io/print_int (app classify (app / 0.0 0.0))))))))))) + (seq (app print (app / 6.0 3.0)) + (seq (app print (app classify (app / 6.0 3.0))) + (seq (app print (app / 1.0 0.0)) + (seq (app print (app classify (app / 1.0 0.0))) + (seq (app print (app / 0.0 0.0)) + (app print (app classify (app / 0.0 0.0))))))))))) diff --git a/examples/fieldtest/forma_1_factorial.ail b/examples/fieldtest/forma_1_factorial.ail index ad6dc2f..b4b8693 100644 --- a/examples/fieldtest/forma_1_factorial.ail +++ b/examples/fieldtest/forma_1_factorial.ail @@ -26,5 +26,5 @@ (params) (body (seq - (do io/print_int (app fact 5)) - (do io/print_int (app fact 10)))))) + (app print (app fact 5)) + (app print (app fact 10)))))) diff --git a/examples/fieldtest/forma_4_intmath_main.ail b/examples/fieldtest/forma_4_intmath_main.ail index 7512742..8ab5af2 100644 --- a/examples/fieldtest/forma_4_intmath_main.ail +++ b/examples/fieldtest/forma_4_intmath_main.ail @@ -8,6 +8,6 @@ (body (seq (seq - (do io/print_int (app forma_4_intmath_lib.square 7)) - (do io/print_int (app forma_4_intmath_lib.cube 3))) - (do io/print_int (app forma_4_intmath_lib.abs_int (app - 0 42))))))) + (app print (app forma_4_intmath_lib.square 7)) + (app print (app forma_4_intmath_lib.cube 3))) + (app print (app forma_4_intmath_lib.abs_int (app - 0 42))))))) diff --git a/examples/floats.ail b/examples/floats.ail index 59e7917..ea3887c 100644 --- a/examples/floats.ail +++ b/examples/floats.ail @@ -2,4 +2,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (seq (do io/print_float (app + 1.5 2.5)) (seq (do io/print_float (app int_to_float 42)) (do io/print_float (app neg 1.5))))))) + (body (seq (app print (app + 1.5 2.5)) (seq (app print (app int_to_float 42)) (app print (app neg 1.5))))))) diff --git a/examples/gc_stress.ail b/examples/gc_stress.ail index 517dede..d5c257d 100644 --- a/examples/gc_stress.ail +++ b/examples/gc_stress.ail @@ -44,4 +44,4 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (do io/print_int (app sum_list (app build 50)))))) + (app print (app sum_list (app build 50)))))) diff --git a/examples/ge_at_int_smoke.ail b/examples/ge_at_int_smoke.ail index 483338e..003a5fd 100644 --- a/examples/ge_at_int_smoke.ail +++ b/examples/ge_at_int_smoke.ail @@ -2,4 +2,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (if (app ge 3 5) 1 0))))) + (body (app print (if (app ge 3 5) 1 0))))) diff --git a/examples/gt_at_bool_smoke.ail b/examples/gt_at_bool_smoke.ail index 48f4f22..ee0baf0 100644 --- a/examples/gt_at_bool_smoke.ail +++ b/examples/gt_at_bool_smoke.ail @@ -2,4 +2,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (if (app gt true false) 1 0))))) + (body (app print (if (app gt true false) 1 0))))) diff --git a/examples/hof.ail b/examples/hof.ail index 6d19849..0be6ba2 100644 --- a/examples/hof.ail +++ b/examples/hof.ail @@ -12,4 +12,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (app apply inc 41))))) + (body (app print (app apply inc 41))))) diff --git a/examples/int_to_print_int_borrow.ail b/examples/int_to_print_int_borrow.ail index c96b9a8..e9be9cc 100644 --- a/examples/int_to_print_int_borrow.ail +++ b/examples/int_to_print_int_borrow.ail @@ -1,6 +1,6 @@ (module int_to_print_int_borrow (fn main - (doc "Iter eob.1: primitive Int passed to io/print_int. The rule that Term::Do args are Borrow has no observable RC effect here because Int is unboxed; the test pins that no spurious bookkeeping appears (allocs == 0, frees == 0, live == 0).") + (doc "Iter eob.1 / rpe.1: primitive Int passed to the polymorphic `print` helper (Show Int). The rule that Term::Do args are Borrow has no observable RC effect here because Int is unboxed; the test pins that no spurious bookkeeping appears (allocs == 0, frees == 0, live == 0).") (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (let n 7 (do io/print_int n))))) + (body (let n 7 (app print n))))) diff --git a/examples/le_at_str_smoke.ail b/examples/le_at_str_smoke.ail index 9ad893a..37ac1c9 100644 --- a/examples/le_at_str_smoke.ail +++ b/examples/le_at_str_smoke.ail @@ -2,4 +2,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (if (app le "abc" "abd") 1 0))))) + (body (app print (if (app le "abc" "abd") 1 0))))) diff --git a/examples/list.ail b/examples/list.ail index 82cd107..c1d4b86 100644 --- a/examples/list.ail +++ b/examples/list.ail @@ -14,4 +14,4 @@ (doc "Baut [10, 20, 12] und druckt die Summe (42).") (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (let xs (term-ctor IntList Cons 10 (term-ctor IntList Cons 20 (term-ctor IntList Cons 12 (term-ctor IntList Nil)))) (do io/print_int (app sum_list xs)))))) + (body (let xs (term-ctor IntList Cons 10 (term-ctor IntList Cons 20 (term-ctor IntList Cons 12 (term-ctor IntList Nil)))) (app print (app sum_list xs)))))) diff --git a/examples/list_map.ail b/examples/list_map.ail index 34a2b38..17ad346 100644 --- a/examples/list_map.ail +++ b/examples/list_map.ail @@ -16,7 +16,7 @@ (params xs) (body (match xs (case (pat-ctor Nil) (lit-unit)) - (case (pat-ctor Cons h t) (seq (do io/print_int h) (app print_list t)))))) + (case (pat-ctor Cons h t) (seq (app print h) (app print_list t)))))) (fn main (doc "Build [1,2,3], double each, print result.") (type (fn-type (params) (ret (con Unit)) (effects IO))) diff --git a/examples/list_map_poly.ail b/examples/list_map_poly.ail index ebe9acf..60eb6ba 100644 --- a/examples/list_map_poly.ail +++ b/examples/list_map_poly.ail @@ -46,7 +46,7 @@ (lit-unit)) (case (pat-ctor Cons h t) (seq - (do io/print_int h) + (app print h) (tail-app print_list t)))))) (fn main diff --git a/examples/lit_pat.ail b/examples/lit_pat.ail index d9d2dc4..0f6188b 100644 --- a/examples/lit_pat.ail +++ b/examples/lit_pat.ail @@ -46,9 +46,9 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_int (app classify 0)) - (seq (do io/print_int (app classify 1)) - (seq (do io/print_int (app classify 17)) - (seq (do io/print_int (app categorize_first (term-ctor IntList Nil))) - (seq (do io/print_int (app categorize_first (term-ctor IntList Cons 0 (term-ctor IntList Nil)))) - (do io/print_int (app categorize_first (term-ctor IntList Cons 7 (term-ctor IntList Nil)))))))))))) + (seq (app print (app classify 0)) + (seq (app print (app classify 1)) + (seq (app print (app classify 17)) + (seq (app print (app categorize_first (term-ctor IntList Nil))) + (seq (app print (app categorize_first (term-ctor IntList Cons 0 (term-ctor IntList Nil)))) + (app print (app categorize_first (term-ctor IntList Cons 7 (term-ctor IntList Nil)))))))))))) diff --git a/examples/local_rec_as_value.ail b/examples/local_rec_as_value.ail index 010f128..cbc873f 100644 --- a/examples/local_rec_as_value.ail +++ b/examples/local_rec_as_value.ail @@ -30,4 +30,4 @@ (if (app <= n 1) 1 (app * n (app factorial (app - n 1))))) - (in (do io/print_int (app apply5 factorial))))))) + (in (app print (app apply5 factorial))))))) diff --git a/examples/local_rec_as_value_capture.ail b/examples/local_rec_as_value_capture.ail index b863c9a..92fcac5 100644 --- a/examples/local_rec_as_value_capture.ail +++ b/examples/local_rec_as_value_capture.ail @@ -39,5 +39,5 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_int (app run_with_base 10)) - (do io/print_int (app run_with_base 100)))))) + (seq (app print (app run_with_base 10)) + (app print (app run_with_base 100)))))) diff --git a/examples/local_rec_capture.ail b/examples/local_rec_capture.ail index e4c17d6..3543fb2 100644 --- a/examples/local_rec_capture.ail +++ b/examples/local_rec_capture.ail @@ -30,6 +30,6 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_int (app sum_below 1)) - (seq (do io/print_int (app sum_below 5)) - (do io/print_int (app sum_below 10))))))) + (seq (app print (app sum_below 1)) + (seq (app print (app sum_below 5)) + (app print (app sum_below 10))))))) diff --git a/examples/local_rec_demo.ail b/examples/local_rec_demo.ail index c49ff7f..7f45a0e 100644 --- a/examples/local_rec_demo.ail +++ b/examples/local_rec_demo.ail @@ -21,6 +21,6 @@ 1 (app * n (app fact (app - n 1))))) (in - (seq (do io/print_int (app fact 1)) - (seq (do io/print_int (app fact 3)) - (do io/print_int (app fact 5))))))))) + (seq (app print (app fact 1)) + (seq (app print (app fact 3)) + (app print (app fact 5))))))))) diff --git a/examples/local_rec_let_capture.ail b/examples/local_rec_let_capture.ail index b778031..0c29a81 100644 --- a/examples/local_rec_let_capture.ail +++ b/examples/local_rec_let_capture.ail @@ -43,6 +43,6 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_int (app count_below 0)) - (seq (do io/print_int (app count_below 5)) - (do io/print_int (app count_below 15))))))) + (seq (app print (app count_below 0)) + (seq (app print (app count_below 5)) + (app print (app count_below 15))))))) diff --git a/examples/local_rec_match_capture.ail b/examples/local_rec_match_capture.ail index cec3593..59107bc 100644 --- a/examples/local_rec_match_capture.ail +++ b/examples/local_rec_match_capture.ail @@ -54,6 +54,6 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_int (app count_below (term-ctor Pair MkPair 10 0))) - (seq (do io/print_int (app count_below (term-ctor Pair MkPair 10 5))) - (do io/print_int (app count_below (term-ctor Pair MkPair 10 15)))))))) + (seq (app print (app count_below (term-ctor Pair MkPair 10 0))) + (seq (app print (app count_below (term-ctor Pair MkPair 10 5))) + (app print (app count_below (term-ctor Pair MkPair 10 15)))))))) diff --git a/examples/lt_at_int_smoke.ail b/examples/lt_at_int_smoke.ail index f37163e..73354c1 100644 --- a/examples/lt_at_int_smoke.ail +++ b/examples/lt_at_int_smoke.ail @@ -2,4 +2,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (if (app lt 3 5) 1 0))))) + (body (app print (if (app lt 3 5) 1 0))))) diff --git a/examples/max3.ail b/examples/max3.ail index 2962999..f1d0e1b 100644 --- a/examples/max3.ail +++ b/examples/max3.ail @@ -11,4 +11,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (app max3 3 17 9))))) + (body (app print (app max3 3 17 9))))) diff --git a/examples/maybe_int.ail b/examples/maybe_int.ail index 48a3014..72171c2 100644 --- a/examples/maybe_int.ail +++ b/examples/maybe_int.ail @@ -14,4 +14,4 @@ (doc "Print or_else for both arms; expected 7 then 99.") (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (seq (do io/print_int (app or_else (term-ctor Maybe Some 7) 99)) (do io/print_int (app or_else (term-ctor Maybe None) 99)))))) + (body (seq (app print (app or_else (term-ctor Maybe Some 7) 99)) (app print (app or_else (term-ctor Maybe None) 99)))))) diff --git a/examples/mono_hash_pin_smoke.ail b/examples/mono_hash_pin_smoke.ail index 1138b96..f9a9304 100644 --- a/examples/mono_hash_pin_smoke.ail +++ b/examples/mono_hash_pin_smoke.ail @@ -9,4 +9,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (seq (do io/print_bool (app eq 1 1)) (seq (do io/print_bool (app eq true true)) (seq (do io/print_bool (app eq "a" "a")) (seq (do io/print_int (app ord_to_int (app compare 1 2))) (seq (do io/print_int (app ord_to_int (app compare false true))) (do io/print_int (app ord_to_int (app compare "a" "b"))))))))))) + (body (seq (app print (app eq 1 1)) (seq (app print (app eq true true)) (seq (app print (app eq "a" "a")) (seq (app print (app ord_to_int (app compare 1 2))) (seq (app print (app ord_to_int (app compare false true))) (app print (app ord_to_int (app compare "a" "b"))))))))))) diff --git a/examples/mq3_class_eq_vs_fn_eq.ail b/examples/mq3_class_eq_vs_fn_eq.ail index da4664f..06dd14c 100644 --- a/examples/mq3_class_eq_vs_fn_eq.ail +++ b/examples/mq3_class_eq_vs_fn_eq.ail @@ -5,4 +5,4 @@ (doc "mq.3.6 fixture (c): bare `myeq 1 2` in a workspace with `class MyEq` (in classmod) and `fn myeq` (in fnmod) both imported. Fn wins per lookup precedence; the typechecker emits `class-method-shadowed-by-fn` warning so the LLM-author sees the shadow.") (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_bool (app myeq 1 2))))) + (body (app print (app myeq 1 2))))) diff --git a/examples/ne_at_int_smoke.ail b/examples/ne_at_int_smoke.ail index 2fe0a0e..8411ee8 100644 --- a/examples/ne_at_int_smoke.ail +++ b/examples/ne_at_int_smoke.ail @@ -2,4 +2,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (if (app ne 3 5) 1 0))))) + (body (app print (if (app ne 3 5) 1 0))))) diff --git a/examples/nested_let_rec.ail b/examples/nested_let_rec.ail index 701713c..a746f42 100644 --- a/examples/nested_let_rec.ail +++ b/examples/nested_let_rec.ail @@ -48,6 +48,6 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_int (app nested_sum 1)) - (seq (do io/print_int (app nested_sum 3)) - (do io/print_int (app nested_sum 5))))))) + (seq (app print (app nested_sum 1)) + (seq (app print (app nested_sum 3)) + (app print (app nested_sum 5))))))) diff --git a/examples/nested_pat.ail b/examples/nested_pat.ail index 4b027a1..8d12033 100644 --- a/examples/nested_pat.ail +++ b/examples/nested_pat.ail @@ -23,7 +23,7 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (do io/print_int (app first_two_sum + (app print (app first_two_sum (term-ctor std_list.List Cons 10 (term-ctor std_list.List Cons 20 (term-ctor std_list.List Cons 30 diff --git a/examples/ordering_match.ail b/examples/ordering_match.ail index 71db9cb..265300f 100644 --- a/examples/ordering_match.ail +++ b/examples/ordering_match.ail @@ -3,7 +3,7 @@ (doc "Iter 23.1 fixture: pattern-match on prelude Ordering ctor without explicit prelude import.") (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (match (term-ctor prelude.Ordering LT) + (body (app print (match (term-ctor prelude.Ordering LT) (case (pat-ctor LT) 1) (case (pat-ctor EQ) 2) (case (pat-ctor GT) 3)))))) diff --git a/examples/ordering_match.prose.txt b/examples/ordering_match.prose.txt index 3d56346..6cc36c5 100644 --- a/examples/ordering_match.prose.txt +++ b/examples/ordering_match.prose.txt @@ -3,7 +3,7 @@ /// Iter 23.1 fixture: pattern-match on prelude Ordering ctor without explicit /// prelude import. fn main() -> Unit with IO { - do io/print_int(match LT { + print(match LT { LT => 1, EQ => 2, GT => 3 diff --git a/examples/pat_extract_partial_drop.ail b/examples/pat_extract_partial_drop.ail index 431dd67..7c8c8df 100644 --- a/examples/pat_extract_partial_drop.ail +++ b/examples/pat_extract_partial_drop.ail @@ -62,4 +62,4 @@ (term-ctor IntList Nil))))) (match p (case (pat-ctor Pair a _) - (do io/print_int (app sum_list a)))))))) + (app print (app sum_list a)))))))) diff --git a/examples/poly_apply.ail b/examples/poly_apply.ail index aa2ba02..76942aa 100644 --- a/examples/poly_apply.ail +++ b/examples/poly_apply.ail @@ -10,4 +10,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (app apply succ 41))))) + (body (app print (app apply succ 41))))) diff --git a/examples/poly_id.ail b/examples/poly_id.ail index 0a67d55..f242daf 100644 --- a/examples/poly_id.ail +++ b/examples/poly_id.ail @@ -6,4 +6,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (seq (do io/print_int (app id 42)) (do io/print_bool (app id true)))))) + (body (seq (app print (app id 42)) (app print (app id true)))))) diff --git a/examples/poly_rec_capture.ail b/examples/poly_rec_capture.ail index 10b44c7..7850d46 100644 --- a/examples/poly_rec_capture.ail +++ b/examples/poly_rec_capture.ail @@ -53,5 +53,5 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_int (app apply_n_times 5 0 succ)) - (do io/print_bool (app apply_n_times 4 false flip)))))) + (seq (app print (app apply_n_times 5 0 succ)) + (app print (app apply_n_times 4 false flip)))))) diff --git a/examples/rc_app_let_partial_drop_leak.ail b/examples/rc_app_let_partial_drop_leak.ail index c2ac681..35ccdb7 100644 --- a/examples/rc_app_let_partial_drop_leak.ail +++ b/examples/rc_app_let_partial_drop_leak.ail @@ -18,5 +18,5 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (let p (app build_pair 1) (do io/print_int (match p + (body (let p (app build_pair 1) (app print (match p (case (pat-ctor MkPair a _) (app use_cell a)))))))) diff --git a/examples/rc_app_let_partial_drop_leak.prose.txt b/examples/rc_app_let_partial_drop_leak.prose.txt index 68a243b..962c919 100644 --- a/examples/rc_app_let_partial_drop_leak.prose.txt +++ b/examples/rc_app_let_partial_drop_leak.prose.txt @@ -18,7 +18,7 @@ fn use_cell(c: own Cell) -> Int { } fn main() -> Unit with IO { - do io/print_int(match build_pair(1) { + print(match build_pair(1) { MkPair(a, _) => use_cell(a) }) } diff --git a/examples/rc_box_drop.ail b/examples/rc_box_drop.ail index 80f144d..cc361a0 100644 --- a/examples/rc_box_drop.ail +++ b/examples/rc_box_drop.ail @@ -7,4 +7,4 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body (let b (term-ctor Box MkBox 42) (match b - (case (pat-ctor MkBox x) (do io/print_int x))))))) + (case (pat-ctor MkBox x) (app print x))))))) diff --git a/examples/rc_drop_iterative_long_list.ail b/examples/rc_drop_iterative_long_list.ail index 7b2452a..42e3d8c 100644 --- a/examples/rc_drop_iterative_long_list.ail +++ b/examples/rc_drop_iterative_long_list.ail @@ -24,4 +24,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (app head_or_zero (app cons_n 1000000)))))) + (body (app print (app head_or_zero (app cons_n 1000000)))))) diff --git a/examples/rc_let_alias_implicit_param.ail b/examples/rc_let_alias_implicit_param.ail index 27fbfa7..56a3e10 100644 --- a/examples/rc_let_alias_implicit_param.ail +++ b/examples/rc_let_alias_implicit_param.ail @@ -76,4 +76,4 @@ (params) (body (let t (app build 2) - (do io/print_int (app loop 3 t)))))) + (app print (app loop 3 t)))))) diff --git a/examples/rc_let_implicit_returning_app.ail b/examples/rc_let_implicit_returning_app.ail index f290086..34be6b6 100644 --- a/examples/rc_let_implicit_returning_app.ail +++ b/examples/rc_let_implicit_returning_app.ail @@ -59,5 +59,5 @@ (params) (body (let x (app alloc 7) - (do io/print_int (app unbox x))))) + (app print (app unbox x))))) ) diff --git a/examples/rc_let_owned_app_leak.ail b/examples/rc_let_owned_app_leak.ail index 1defc60..88a5507 100644 --- a/examples/rc_let_owned_app_leak.ail +++ b/examples/rc_let_owned_app_leak.ail @@ -50,4 +50,4 @@ (params) (body (let t (app build 1) - (do io/print_int (app pin t)))))) + (app print (app pin t)))))) diff --git a/examples/rc_list_drop.ail b/examples/rc_list_drop.ail index 322b212..981d651 100644 --- a/examples/rc_list_drop.ail +++ b/examples/rc_list_drop.ail @@ -14,4 +14,4 @@ (doc "Build a 5-element IntList [1,2,3,4,5] and print its sum (15). Under --alloc=rc the recursive drop_rc_list_drop_IntList fn cascades through the tail at process exit when sum_list returns ownership-implicit (the consume_count of `xs` is 1 so no dec at the outer let; the test's correctness invariant is the byte-identical stdout — leak quantification is 18f's bench).") (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (let xs (term-ctor IntList Cons 1 (term-ctor IntList Cons 2 (term-ctor IntList Cons 3 (term-ctor IntList Cons 4 (term-ctor IntList Cons 5 (term-ctor IntList Nil)))))) (do io/print_int (app sum_list xs)))))) + (body (let xs (term-ctor IntList Cons 1 (term-ctor IntList Cons 2 (term-ctor IntList Cons 3 (term-ctor IntList Cons 4 (term-ctor IntList Cons 5 (term-ctor IntList Nil)))))) (app print (app sum_list xs)))))) diff --git a/examples/rc_list_drop_borrow.ail b/examples/rc_list_drop_borrow.ail index c0e842d..855eeee 100644 --- a/examples/rc_list_drop_borrow.ail +++ b/examples/rc_list_drop_borrow.ail @@ -8,5 +8,5 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body (let xs (term-ctor IntList Cons 11 (term-ctor IntList Cons 22 (term-ctor IntList Cons 33 (term-ctor IntList Cons 44 (term-ctor IntList Cons 55 (term-ctor IntList Nil)))))) (match xs - (case (pat-ctor Nil) (do io/print_int 0)) - (case (pat-ctor Cons h t) (do io/print_int h))))))) + (case (pat-ctor Nil) (app print 0)) + (case (pat-ctor Cons h t) (app print h))))))) diff --git a/examples/rc_match_arm_partial_drop_leak.ail b/examples/rc_match_arm_partial_drop_leak.ail index 4bf6285..06851a4 100644 --- a/examples/rc_match_arm_partial_drop_leak.ail +++ b/examples/rc_match_arm_partial_drop_leak.ail @@ -19,4 +19,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (app use_first (app build_pair 1)))))) + (body (app print (app use_first (app build_pair 1)))))) diff --git a/examples/rc_match_arm_partial_drop_leak.prose.txt b/examples/rc_match_arm_partial_drop_leak.prose.txt index 11e76df..e7fbd03 100644 --- a/examples/rc_match_arm_partial_drop_leak.prose.txt +++ b/examples/rc_match_arm_partial_drop_leak.prose.txt @@ -20,5 +20,5 @@ fn use_first(p: own Pair) -> Int { } fn main() -> Unit with IO { - do io/print_int(use_first(build_pair(1))) + print(use_first(build_pair(1))) } diff --git a/examples/rc_own_param_drop.ail b/examples/rc_own_param_drop.ail index 2cf3339..5a9df42 100644 --- a/examples/rc_own_param_drop.ail +++ b/examples/rc_own_param_drop.ail @@ -15,4 +15,4 @@ (doc "Build a 5-element IntList; pass to head_or_zero (transferring ownership); print the result.") (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (let xs (term-ctor IntList Cons 11 (term-ctor IntList Cons 22 (term-ctor IntList Cons 33 (term-ctor IntList Cons 44 (term-ctor IntList Cons 55 (term-ctor IntList Nil)))))) (do io/print_int (app head_or_zero xs)))))) + (body (let xs (term-ctor IntList Cons 11 (term-ctor IntList Cons 22 (term-ctor IntList Cons 33 (term-ctor IntList Cons 44 (term-ctor IntList Cons 55 (term-ctor IntList Nil)))))) (app print (app head_or_zero xs)))))) diff --git a/examples/rc_own_param_drop.prose.txt b/examples/rc_own_param_drop.prose.txt index db37cd5..67afcf8 100644 --- a/examples/rc_own_param_drop.prose.txt +++ b/examples/rc_own_param_drop.prose.txt @@ -18,5 +18,5 @@ fn head_or_zero(xs: own IntList) -> Int { /// print the result. fn main() -> Unit with IO { let xs = Cons(11, Cons(22, Cons(33, Cons(44, Cons(55, Nil))))); - do io/print_int(head_or_zero(xs)) + print(head_or_zero(xs)) } diff --git a/examples/rc_own_param_partial_drop_leak.ail b/examples/rc_own_param_partial_drop_leak.ail index 2d75ffe..5deffdc 100644 --- a/examples/rc_own_param_partial_drop_leak.ail +++ b/examples/rc_own_param_partial_drop_leak.ail @@ -18,4 +18,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (app use_first (app build_pair 1)))))) + (body (app print (app use_first (app build_pair 1)))))) diff --git a/examples/rc_pin_recurse_implicit.ail b/examples/rc_pin_recurse_implicit.ail index ed922fb..15f84cc 100644 --- a/examples/rc_pin_recurse_implicit.ail +++ b/examples/rc_pin_recurse_implicit.ail @@ -52,4 +52,4 @@ (params) (body (let t (app build 2) - (do io/print_int (app loop 3 t)))))) + (app print (app loop 3 t)))))) diff --git a/examples/rc_tail_sum_explicit_leak.ail b/examples/rc_tail_sum_explicit_leak.ail index a5924c4..b805911 100644 --- a/examples/rc_tail_sum_explicit_leak.ail +++ b/examples/rc_tail_sum_explicit_leak.ail @@ -66,4 +66,4 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (do io/print_int (app sum_list (app cons_n 100)))))) + (app print (app sum_list (app cons_n 100)))))) diff --git a/examples/reuse_as_demo.ail b/examples/reuse_as_demo.ail index 09f32a3..8e79a65 100644 --- a/examples/reuse_as_demo.ail +++ b/examples/reuse_as_demo.ail @@ -61,4 +61,4 @@ (term-ctor List Cons 2 (term-ctor List Cons 3 (term-ctor List Nil)))) - (do io/print_int (app sum_list (app map_inc xs))))))) + (app print (app sum_list (app map_inc xs))))))) diff --git a/examples/sort.ail b/examples/sort.ail index bd265c9..870bfaf 100644 --- a/examples/sort.ail +++ b/examples/sort.ail @@ -22,7 +22,7 @@ (params xs) (body (match xs (case (pat-ctor Nil) (lit-unit)) - (case (pat-ctor Cons h t) (seq (do io/print_int h) (tail-app print_list t)))))) + (case (pat-ctor Cons h t) (seq (app print h) (tail-app print_list t)))))) (fn main (doc "Sort and print [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5].") (type (fn-type (params) (ret (con Unit)) (effects IO))) diff --git a/examples/std_either_demo.ail b/examples/std_either_demo.ail index ea01e4a..d9255b0 100644 --- a/examples/std_either_demo.ail +++ b/examples/std_either_demo.ail @@ -18,14 +18,14 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_int (app std_either.from_right 0 (term-ctor std_either.Either Right 42))) - (seq (do io/print_int (app std_either.from_right 99 (term-ctor std_either.Either Left 7))) - (seq (do io/print_bool (app std_either.is_left (term-ctor std_either.Either Left 7))) - (seq (do io/print_bool (app std_either.is_right (term-ctor std_either.Either Right 42))) - (seq (do io/print_int (app std_either.from_right 0 + (seq (app print (app std_either.from_right 0 (term-ctor std_either.Either Right 42))) + (seq (app print (app std_either.from_right 99 (term-ctor std_either.Either Left 7))) + (seq (app print (app std_either.is_left (term-ctor std_either.Either Left 7))) + (seq (app print (app std_either.is_right (term-ctor std_either.Either Right 42))) + (seq (app print (app std_either.from_right 0 (app std_either.map_right inc (term-ctor std_either.Either Right 41)))) - (seq (do io/print_int (app std_either.either inc inc + (seq (app print (app std_either.either inc inc (term-ctor std_either.Either Left 5))) - (do io/print_int (app std_either.either inc inc + (app print (app std_either.either inc inc (term-ctor std_either.Either Right 100)))))))))))) diff --git a/examples/std_either_list_demo.ail b/examples/std_either_list_demo.ail index b0018f6..b38c797 100644 --- a/examples/std_either_list_demo.ail +++ b/examples/std_either_list_demo.ail @@ -24,7 +24,7 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_int (app std_list.length (app std_either_list.lefts (term-ctor std_list.List Cons (term-ctor std_either.Either Left 1) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 10) (term-ctor std_list.List Cons (term-ctor std_either.Either Left 2) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 20) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 30) (term-ctor std_list.List Nil))))))))) - (seq (do io/print_int (app std_list.length (app std_either_list.rights (term-ctor std_list.List Cons (term-ctor std_either.Either Left 1) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 10) (term-ctor std_list.List Cons (term-ctor std_either.Either Left 2) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 20) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 30) (term-ctor std_list.List Nil))))))))) - (seq (do io/print_int (app std_list.length (app std_pair.fst (app std_either_list.partition_eithers (term-ctor std_list.List Cons (term-ctor std_either.Either Left 1) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 10) (term-ctor std_list.List Cons (term-ctor std_either.Either Left 2) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 20) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 30) (term-ctor std_list.List Nil)))))))))) - (do io/print_int (app std_list.length (app std_pair.snd (app std_either_list.partition_eithers (term-ctor std_list.List Cons (term-ctor std_either.Either Left 1) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 10) (term-ctor std_list.List Cons (term-ctor std_either.Either Left 2) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 20) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 30) (term-ctor std_list.List Nil)))))))))))))))) + (seq (app print (app std_list.length (app std_either_list.lefts (term-ctor std_list.List Cons (term-ctor std_either.Either Left 1) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 10) (term-ctor std_list.List Cons (term-ctor std_either.Either Left 2) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 20) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 30) (term-ctor std_list.List Nil))))))))) + (seq (app print (app std_list.length (app std_either_list.rights (term-ctor std_list.List Cons (term-ctor std_either.Either Left 1) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 10) (term-ctor std_list.List Cons (term-ctor std_either.Either Left 2) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 20) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 30) (term-ctor std_list.List Nil))))))))) + (seq (app print (app std_list.length (app std_pair.fst (app std_either_list.partition_eithers (term-ctor std_list.List Cons (term-ctor std_either.Either Left 1) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 10) (term-ctor std_list.List Cons (term-ctor std_either.Either Left 2) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 20) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 30) (term-ctor std_list.List Nil)))))))))) + (app print (app std_list.length (app std_pair.snd (app std_either_list.partition_eithers (term-ctor std_list.List Cons (term-ctor std_either.Either Left 1) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 10) (term-ctor std_list.List Cons (term-ctor std_either.Either Left 2) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 20) (term-ctor std_list.List Cons (term-ctor std_either.Either Right 30) (term-ctor std_list.List Nil)))))))))))))))) diff --git a/examples/std_list_demo.ail b/examples/std_list_demo.ail index 9170f39..a405981 100644 --- a/examples/std_list_demo.ail +++ b/examples/std_list_demo.ail @@ -48,14 +48,14 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_int (app std_list.length xs)) - (seq (do io/print_bool (app std_list.is_empty xs)) - (seq (do io/print_bool (app std_list.is_empty (term-ctor std_list.List Nil))) - (seq (do io/print_int (app std_maybe.from_maybe -1 (app std_list.head xs))) - (seq (do io/print_int (app std_list.length (app std_maybe.from_maybe xs (app std_list.tail xs)))) - (seq (do io/print_int (app std_list.length (app std_list.append xs xs))) - (seq (do io/print_int (app std_maybe.from_maybe -1 (app std_list.head (app std_list.reverse xs)))) - (seq (do io/print_int (app std_maybe.from_maybe -1 (app std_list.head (app std_list.map double xs)))) - (seq (do io/print_int (app std_list.length (app std_list.filter is_even xs))) - (seq (do io/print_int (app std_list.fold_left add 0 xs)) - (do io/print_int (app std_list.fold_right add 0 xs))))))))))))))) + (seq (app print (app std_list.length xs)) + (seq (app print (app std_list.is_empty xs)) + (seq (app print (app std_list.is_empty (term-ctor std_list.List Nil))) + (seq (app print (app std_maybe.from_maybe -1 (app std_list.head xs))) + (seq (app print (app std_list.length (app std_maybe.from_maybe xs (app std_list.tail xs)))) + (seq (app print (app std_list.length (app std_list.append xs xs))) + (seq (app print (app std_maybe.from_maybe -1 (app std_list.head (app std_list.reverse xs)))) + (seq (app print (app std_maybe.from_maybe -1 (app std_list.head (app std_list.map double xs)))) + (seq (app print (app std_list.length (app std_list.filter is_even xs))) + (seq (app print (app std_list.fold_left add 0 xs)) + (app print (app std_list.fold_right add 0 xs))))))))))))))) diff --git a/examples/std_list_more_demo.ail b/examples/std_list_more_demo.ail index 9820d95..01d8f7c 100644 --- a/examples/std_list_more_demo.ail +++ b/examples/std_list_more_demo.ail @@ -24,9 +24,9 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_int (app std_list.length (app std_list.take 0 xs))) - (seq (do io/print_int (app std_list.length (app std_list.take 3 xs))) - (seq (do io/print_int (app std_list.length (app std_list.take 100 xs))) - (seq (do io/print_int (app std_list.length (app std_list.drop 0 xs))) - (seq (do io/print_int (app std_list.length (app std_list.drop 2 xs))) - (do io/print_int (app std_list.length (app std_list.drop 100 xs))))))))))) + (seq (app print (app std_list.length (app std_list.take 0 xs))) + (seq (app print (app std_list.length (app std_list.take 3 xs))) + (seq (app print (app std_list.length (app std_list.take 100 xs))) + (seq (app print (app std_list.length (app std_list.drop 0 xs))) + (seq (app print (app std_list.length (app std_list.drop 2 xs))) + (app print (app std_list.length (app std_list.drop 100 xs))))))))))) diff --git a/examples/std_list_stress.ail b/examples/std_list_stress.ail index 38b966b..c35cb1d 100644 --- a/examples/std_list_stress.ail +++ b/examples/std_list_stress.ail @@ -37,5 +37,5 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_int (app std_list.fold_left add 0 (app build 1000))) - (do io/print_int (app std_list.fold_right add 0 (app build 1000))))))) + (seq (app print (app std_list.fold_left add 0 (app build 1000))) + (app print (app std_list.fold_right add 0 (app build 1000))))))) diff --git a/examples/std_maybe_demo.ail b/examples/std_maybe_demo.ail index 2b4e57d..2623a17 100644 --- a/examples/std_maybe_demo.ail +++ b/examples/std_maybe_demo.ail @@ -23,8 +23,8 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_int (app std_maybe.from_maybe 99 (term-ctor std_maybe.Maybe Just 7))) - (seq (do io/print_int (app std_maybe.from_maybe 99 (term-ctor std_maybe.Maybe Nothing))) - (seq (do io/print_bool (app std_maybe.is_some (term-ctor std_maybe.Maybe Just 5))) - (seq (do io/print_bool (app std_maybe.is_none (term-ctor std_maybe.Maybe Nothing))) - (do io/print_int (app std_maybe.from_maybe 0 (app std_maybe.map_maybe inc (term-ctor std_maybe.Maybe Just 41))))))))))) + (seq (app print (app std_maybe.from_maybe 99 (term-ctor std_maybe.Maybe Just 7))) + (seq (app print (app std_maybe.from_maybe 99 (term-ctor std_maybe.Maybe Nothing))) + (seq (app print (app std_maybe.is_some (term-ctor std_maybe.Maybe Just 5))) + (seq (app print (app std_maybe.is_none (term-ctor std_maybe.Maybe Nothing))) + (app print (app std_maybe.from_maybe 0 (app std_maybe.map_maybe inc (term-ctor std_maybe.Maybe Just 41))))))))))) diff --git a/examples/std_pair_demo.ail b/examples/std_pair_demo.ail index 1d63954..f10e8e9 100644 --- a/examples/std_pair_demo.ail +++ b/examples/std_pair_demo.ail @@ -24,9 +24,9 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_int (app std_pair.fst (term-ctor std_pair.Pair MkPair 7 9))) - (seq (do io/print_int (app std_pair.snd (term-ctor std_pair.Pair MkPair 7 9))) - (seq (do io/print_int (app std_pair.fst (app std_pair.swap (term-ctor std_pair.Pair MkPair 7 9)))) - (seq (do io/print_int (app std_pair.snd (app std_pair.swap (term-ctor std_pair.Pair MkPair 7 9)))) - (seq (do io/print_int (app std_pair.fst (app std_pair.map_first inc (term-ctor std_pair.Pair MkPair 7 9)))) - (do io/print_int (app std_pair.snd (app std_pair.map_second double (term-ctor std_pair.Pair MkPair 7 9)))))))))))) + (seq (app print (app std_pair.fst (term-ctor std_pair.Pair MkPair 7 9))) + (seq (app print (app std_pair.snd (term-ctor std_pair.Pair MkPair 7 9))) + (seq (app print (app std_pair.fst (app std_pair.swap (term-ctor std_pair.Pair MkPair 7 9)))) + (seq (app print (app std_pair.snd (app std_pair.swap (term-ctor std_pair.Pair MkPair 7 9)))) + (seq (app print (app std_pair.fst (app std_pair.map_first inc (term-ctor std_pair.Pair MkPair 7 9)))) + (app print (app std_pair.snd (app std_pair.map_second double (term-ctor std_pair.Pair MkPair 7 9)))))))))))) diff --git a/examples/sum.ail b/examples/sum.ail index b8a8df7..8770bbb 100644 --- a/examples/sum.ail +++ b/examples/sum.ail @@ -7,4 +7,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (app sum 10))))) + (body (app print (app sum 10))))) diff --git a/examples/test_22b3_coherence_two_instances.ail b/examples/test_22b3_coherence_two_instances.ail index c7d2015..41e43fa 100644 --- a/examples/test_22b3_coherence_two_instances.ail +++ b/examples/test_22b3_coherence_two_instances.ail @@ -16,4 +16,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (seq (do io/print_int (app r 0)) (do io/print_int (app r true)))))) + (body (seq (app print (app r 0)) (app print (app r true)))))) diff --git a/examples/test_22b3_default_e2e.ail b/examples/test_22b3_default_e2e.ail index 6e35280..6cfcae6 100644 --- a/examples/test_22b3_default_e2e.ail +++ b/examples/test_22b3_default_e2e.ail @@ -10,4 +10,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (app dval 0))))) + (body (app print (app dval 0))))) diff --git a/examples/test_22b3_default_e2e.prose.txt b/examples/test_22b3_default_e2e.prose.txt index acaf283..6e4a33e 100644 --- a/examples/test_22b3_default_e2e.prose.txt +++ b/examples/test_22b3_default_e2e.prose.txt @@ -12,5 +12,5 @@ instance D Int { } fn main() -> Unit with IO { - do io/print_int(dval(0)) + print(dval(0)) } diff --git a/examples/test_22b3_mono_synthetic.ail b/examples/test_22b3_mono_synthetic.ail index 101bf85..8867871 100644 --- a/examples/test_22b3_mono_synthetic.ail +++ b/examples/test_22b3_mono_synthetic.ail @@ -11,4 +11,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (app foo 5))))) + (body (app print (app foo 5))))) diff --git a/examples/test_22b3_xmod_e2e_main.ail b/examples/test_22b3_xmod_e2e_main.ail index 75ff552..f8f5cc4 100644 --- a/examples/test_22b3_xmod_e2e_main.ail +++ b/examples/test_22b3_xmod_e2e_main.ail @@ -3,4 +3,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (app xr 0))))) + (body (app print (app xr 0))))) diff --git a/examples/test_22c_user_class_e2e.ail b/examples/test_22c_user_class_e2e.ail index 77091e1..3d43399 100644 --- a/examples/test_22c_user_class_e2e.ail +++ b/examples/test_22c_user_class_e2e.ail @@ -14,4 +14,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (app foo (term-ctor IntBox MkIntBox 42)))))) + (body (app print (app foo (term-ctor IntBox MkIntBox 42)))))) diff --git a/examples/test_mono_ctor_main.ail b/examples/test_mono_ctor_main.ail index d8d434a..a6f1bed 100644 --- a/examples/test_mono_ctor_main.ail +++ b/examples/test_mono_ctor_main.ail @@ -19,4 +19,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (app head_or_zero (term-ctor test_mono_ctor_listmod.List Cons 7 (term-ctor test_mono_ctor_listmod.List Nil))))))) + (body (app print (app head_or_zero (term-ctor test_mono_ctor_listmod.List Cons 7 (term-ctor test_mono_ctor_listmod.List Nil))))))) diff --git a/examples/test_mono_imports_main.ail b/examples/test_mono_imports_main.ail index 5d78256..df66f9c 100644 --- a/examples/test_mono_imports_main.ail +++ b/examples/test_mono_imports_main.ail @@ -3,4 +3,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (app test_mono_imports_classmod.helper 42))))) + (body (app print (app test_mono_imports_classmod.helper 42))))) diff --git a/examples/test_mono_recursive_fn_bug.ail b/examples/test_mono_recursive_fn_bug.ail index db79b64..ed57996 100644 --- a/examples/test_mono_recursive_fn_bug.ail +++ b/examples/test_mono_recursive_fn_bug.ail @@ -15,4 +15,4 @@ (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (app loop 0 5))))) + (body (app print (app loop 0 5))))) diff --git a/examples/unreachable_demo.ail b/examples/unreachable_demo.ail index 11caf58..0eb0755 100644 --- a/examples/unreachable_demo.ail +++ b/examples/unreachable_demo.ail @@ -31,5 +31,5 @@ (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body - (seq (do io/print_int (app safe_div 8 2)) - (do io/print_int (app safe_div 15 3)))))) + (seq (app print (app safe_div 8 2)) + (app print (app safe_div 15 3)))))) diff --git a/examples/ws_main.ail b/examples/ws_main.ail index 373f43f..0913498 100644 --- a/examples/ws_main.ail +++ b/examples/ws_main.ail @@ -4,4 +4,4 @@ (doc "Iter 5b fixture: ruft ws_lib.add auf, druckt das Ergebnis. So ist Cross-Module-Typcheck am Beispiel beobachtbar.") (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) - (body (do io/print_int (app ws_lib.add 2 3))))) + (body (app print (app ws_lib.add 2 3))))) diff --git a/runtime/str.c b/runtime/str.c index b9b064a..581cc34 100644 --- a/runtime/str.c +++ b/runtime/str.c @@ -115,7 +115,9 @@ char *ailang_int_to_str(int64_t n) { } /* Convert a double into a heap-allocated Str. Format `"%g"` — - * matches `io/print_float`'s libc rendering for IEEE consistency. + * the same libc rendering used throughout the runtime for Float + * text output (post-iter-rpe.1 polymorphic `print` for Float + * routes here via `Show Float.show`). * NaN renders as libc-default (`nan`/`-nan`/etc.); ±Inf as `inf` * /`-inf`. Worst-case width for `%g` on a `double` is bounded by * the libc default precision (`%.6g` ⇒ at most ~13 chars including