All documentation pages
Introduction
Pudu is a statically typed programming language for programs that are easy to read, safe to change, and honest about failure. What a function takes, what it gives back, whether it can fail, and whether it changes what it was given are all written in its signature, so a reader can tell what code promises without reading its body.
Pudu is pre-release (0.1.0). Programs run on an interpreter, dependencies are local directories, and the language and its standard library may still change before a stable release.
What Pudu looks like
module Hello
import Std.Io as Io
fn main() -> Int {
let _written = Io.writeLine("Hello from Pudu!")
0
}Every file names its module, imports what it uses, and declares what it exports. A program starts at main, and the whole number main returns is the program's exit status.
Install
No binary release has been published yet. Pudu builds from source with GHC 9.10 or later and Cabal 3.12 or later:
git clone https://github.com/chrismichaelps/pudu-lang.git
cd pudu-lang
cabal install exe:pudu --installdir="$HOME/.local/bin" --overwrite-policy=always
pudu versionThe installed pudu carries its standard library, so nothing else needs to be installed beside it. macOS and Linux x86-64 are tested; Windows is not.
Run your first program
Save the program above as Hello.pudu and run it:
pudu run Hello.puduTo start a project with its own manifest, source directory, and tests:
pudu init hello
cd hello
pudu run src/Main.pudu
pudu testWhat Pudu is built around
- Failure is a value. A function that can fail returns
Result[T, E], and the caller decides what happens. There are no exceptions. - Absence is a value.
Option[T]holdsSome(value)orNone. Ordinary types never holdnull. - Change is visible.
letnever changes,varmay, and&mut Tmarks the one place allowed to change a borrowed value. - Patterns are checked. A
matchmust cover every shape a value can have. - Imports are explicit. There are no wildcard imports, so every name's origin is in the import list.
How this documentation is organised
The chapters are written to be read in order, each building on the ones before it:
- Starting out — getting started, basics, functions, and types.
- Working with data — text, collections, control flow, and errors.
- Structuring programs — ownership, modules and packages, traits, and generics.
- Building real software — testing, files and the system, data formats, HTTP, and concurrency.
- Reference — the standard library map and tooling.
Every example is a complete program. Copy one into a file named after its module, run it with pudu run, and change it to see what happens. If you already know what you are looking for, the API reference lists everything a program can import.
