Prelude
March Standard Library Prelude
Everything in this module is auto-imported into every March program. These are the most commonly needed functions and types.
Sections:
- Diverging (panic, todo, unreachable)
- Option helpers
- Result helpers
- List basics
- Combinators (identity, compose, flip, const)
- String helpers
Functions
Terminates the program with a runtime error. Used for violated invariants — bugs, not expected failures. Propagates to the enclosing actor boundary.
Marks code as not yet implemented. Typechecks as any type so you can sketch a program top-down. Never valid in production.
Asserts that a code path is unreachable.
Extracts the value from Some(x), panicking if None.
Returns the contained value, or default if None.
Returns the first element of the list. Panics if empty.
Returns all but the first element. Panics if empty.
Returns true if the list is empty.
Returns the number of elements in the list.
Reverses a list.
Left fold over a list.
Returns only the elements satisfying pred.
Applies f to every element of the list.
The identity function — returns its argument unchanged.
Function composition: compose(f, g)(x) = f(g(x)).
Flips the order of arguments: flip(f)(b, a) = f(a, b).
Returns a function that always returns x, ignoring its argument.
Prints a value using its Show representation, with a trailing newline.
Converts any value to its string representation.