Examples

Where to find runnable Sounio code in the repo.

Examples

This repository contains two good sources of “known-good” Sounio code:

  • tests/run-pass/: small, focused programs used by CI (best for learning syntax)
  • examples/: larger demos and domain code (some may be aspirational or require feature flags)

JOSS Canonical Examples

These are the canonical examples used in submission smoke checks:

souc run examples/hello.sio
souc run examples/epistemic_bmi.sio
souc run examples/pbpk_simple.sio
souc run examples/gpu_hypercomplex.sio

Expected behavior: all commands complete successfully without compiler/runtime errors.

Compile-fail smoke (effect annotation):

souc check tests/compile-fail/effect_missing.sio

Expected behavior: compile error indicating missing IO effect annotation.

Run a Test Fixture

souc run tests/run-pass/hello.sio
souc run tests/run-pass/for_in_loops.sio
souc check tests/run-pass/async_basic.sio

COVID 2020 Kernel (Typed Refusal)

Use the March 2020 kernel to show temporal + epistemic constraints at souc check time:

souc check tests/run-pass/covid_2020_kernel.sio

Expected behavior: compiles cleanly when validity and confidence constraints are satisfied.

Vancomycin Safety Propagation

Run the propagation demo and the refusal fixture together:

souc check tests/run-pass/vancomycin_propagation.sio
souc check tests/compile-fail/vancomycin_low_conf.sio

Expected behavior:

  • propagation demo passes and shows confidence widening/narrowing across steps
  • low-confidence prescription fixture fails at compile time (epsilon bound violation)

Vancomycin Dosing That Cannot Lie About Uncertainty

See full case study

A Few Canonical Snippets

Hello world:

fn main() with IO {
    println("Hello, Sounio!")
}

Match:

let y = match x {
    0 => 10
    1 => 20
    _ => 30
}

Explicit Knowledge<T> unwrap:

let k = Knowledge { value: 42.0 }
let x: f64 = k.unwrap("accepted for demo")

Next