Skip to content
Noodle
InstallLearnPlayground
GitHub

Prelude and modules

Noodle’s core syntax is intentionally smaller than the set of names used by ordinary programs. The selected standard library supplies primitive type bindings, common datatypes, capability interfaces, collections, text operations, diagnostics, testing, and platform-neutral utility modules.

Every package has an implicit stdlib dependency unless its manifest sets "no-stdlib": true. The selected standard library must provide a public module named Prelude; its exports are added to the initial unqualified scope of every source module in the package.

This is why code can normally write these names without a module qualifier:

  • primitive views: Int, Bool, String, Char, Double, Array[T], and MutArray[T];
  • common datatypes: Option[T], Result[T, E], Task[T, E], and AsyncResult[T, E];
  • collection types such as SortedMap[K, V];
  • capability interfaces such as IEqual, ICompare, IAdd, IDebug, and IIterable;
  • shared errors such as IndexError.

Only Unit is predeclared as a source type name independently of Prelude. Literal and operator syntax belongs to the language, but the conventional names and many of their methods come from the standard library.

Prelude does not open every standard-library module. Module functions use their qualified names:

func main() -> Unit do
Console.println("Hello");
Debug.trace(42);
character = Char.from_codepoint(78);
Console.println(character.to_string());
end

Console, Debug, and Char are visible modules. Their exported declarations remain qualified so call sites show which service they use.

Prelude type aliases carry associated extensions. Those providers make methods and operators available without a separate activation:

func main() -> Unit do
text = 42.to_string();
value = 21 * 2;
same = value == 42;
Console.println(text);
Debug.trace(same);
end

The method and operator syntax is checked through the same interface and extension system described in Interfaces and extensions. Equality, ordering, hashing, and diagnostic representations are covered in Structural capabilities.

Local declarations can shadow Prelude names

Section titled “Local declarations can shadow Prelude names”

A declaration in the current source module takes priority over a same-named Prelude declaration. Shadowing does not change the underlying primitive representation produced by literal syntax; it only changes how source names resolve. Avoid reusing foundational Prelude names unless the distinction is deliberate and well documented.

With "no-stdlib": true, Prelude is not opened. Literal and core language syntax remain, but source names such as Int, String, Array, and Option need explicit declarations or qualified bindings. This mode is for building a standard library or another deliberately minimal environment, not the normal application workflow.

The rest of this section documents the current public library surface by topic. Start with Arrays.