Pudu standard library
The standard library ships with the compiler. Every module lives under Std, nothing is imported implicitly, and a program imports exactly the modules it uses. Pick a section, or search by name or type from the top of any page.
Core values
The types every program uses: optional values, results, characters, comparisons, and the traits behind them.
| Std.Option | A value that may be absent: Some(value) or None. |
| Std.Result | Work that may fail: Ok(value) or Err(problem). |
| Std.Bool | Combining truth values across arrays. |
| Std.Char | Single characters: classes, case, and digits. |
| Std.Tuple | Pairs and the functions that take them apart. |
| Std.Function | Functions as values: composition, identity, and application. |
| Std.Order | Comparisons, orderings, and sort predicates. |
| Std.Show | Rendering values as text. |
| Std.Num | The traits behind arithmetic. |
| Std.Mappable | Containers whose values can be replaced. |
Text
Searching, building, parsing, and formatting text.
| Std.Text | Searching, splitting, trimming, and reading numbers from text. |
| Std.Fmt | Padding, alignment, and number formatting. |
| Std.Regex | Regular expressions with a step limit. |
| Std.Glob | Shell-style wildcard patterns. |
| Std.Diff | Line differences and unified diff hunks. |
| Std.Intern | Pools that store each distinct text once. |
| Std.Semver | Semantic versions: parsing and comparison. |
| Std.Uuid | Universally unique identifiers. |
| Std.Validate | Checking form input field by field. |
Numbers
Arithmetic past the operators: exact decimals, bit manipulation, randomness, and numeric columns.
| Std.Math | Numeric functions for whole and floating numbers. |
| Std.Decimal | Exact decimal arithmetic and rounding. |
| Std.Bits | Bitwise operations and bit counts for every integer width. |
| Std.Random | Seeded pseudo-random numbers. |
| Std.Column | Element-wise arithmetic over numeric columns. |
Collections
Arrays, maps, sets, and the specialised structures for when the ordinary ones are not the right shape. Collections never change in place: every operation answers a new value.
| Std.List | Arrays: sorting, grouping, searching, and folding. |
| Std.Map | Ordered maps from keys to values. |
| Std.Set | Ordered sets. |
| Std.Iter | Sequences a for loop can walk. |
| Std.NonEmpty | Arrays that always hold at least one element. |
| Std.Deque | Double-ended queues. |
| Std.Heap | Priority queues. |
| Std.HashMap | Maps spread across hashed buckets. |
| Std.SortedMap | Maps kept in key order with range queries. |
| Std.LinkedMap | Maps that remember insertion order. |
| Std.FlatMap | Maps from 64-bit keys in one flat table. |
| Std.IntMap | Maps keyed by whole numbers. |
| Std.IntSet | Sets of whole numbers. |
| Std.EnumMap | Maps over a fixed domain of keys. |
| Std.BiMap | Maps that look up in both directions. |
| Std.MultiMap | Maps holding several values under one key. |
| Std.MultiKeyMap | Maps keyed by more than one part. |
| Std.Tree | Labelled trees addressed by path. |
| Std.PrefixTrie | Tries for lookups by key prefix. |
| Std.Graph | Directed graphs and their traversals. |
| Std.DisjointSet | Union-find over connected components. |
| Std.FenwickTree | Prefix sums that update in place of a rebuild. |
| Std.IntervalTree | Finding the intervals that overlap a point or range. |
| Std.RingBuffer | Fixed-capacity circular buffers. |
| Std.LruCache | Caches that discard the least recently used entry. |
| Std.BitSet | Sparse sets of numeric identifiers. |
| Std.BitVector | Dense vectors of bits. |
| Std.BloomFilter | Probabilistic membership tests. |
| Std.RadixSort | Sorting 64-bit integers by their digits. |
Files, processes, and time
Everything that talks to the machine a program runs on.
| Std.Io | Standard input and output, files, and streaming readers. |
| Std.Fs | Atomic writes, temporary files, permissions, and metadata. |
| Std.Path | Building and taking apart file paths. |
| Std.Env | Arguments, environment variables, and the clock. |
| Std.Args | Command-line options, checked and typed. |
| Std.Process | Starting other programs and talking to them. |
| Std.Signal | Requests from outside the program to stop. |
| Std.Time | Dates, times, durations, and their text forms. |
| Std.Log | Structured, levelled logging. |
| Std.Out | Printing values with a chosen layout. |
Data formats
Reading and writing the formats programs exchange.
Bytes, hashing, and compression
Binary data, encodings, non-cryptographic hashes, and archives.
| Std.Bytes | Byte arrays, slices, hex, and base64. |
| Std.Buffer | Contiguous, fixed-length byte buffers. |
| Std.ByteOrder | Big- and little-endian integers. |
| Std.Hex | Hexadecimal digits and bytes. |
| Std.Varint | LEB128 variable-length integers. |
| Std.Adler32 | The Adler-32 checksum. |
| Std.Murmur3 | The MurmurHash3 hash. |
| Std.SipHash | The SipHash keyed hash. |
| Std.Compress.Gzip | Gzip compression and decompression. |
| Std.Archive.Tar | Reading and writing tar archives. |
| Std.Archive.Zip | Reading and writing zip archives. |
Networking and the web
Sockets, TLS, HTTP clients and servers, HTML, and mail.
| Std.Net | TCP sockets: listening, connecting, reading, and writing. |
| Std.Tls | Verified TLS connections. |
| Std.Url | Parsing and building URLs. |
| Std.Http | HTTP messages, clients, and servers with routing and limits. |
| Std.Html | HTML built as values and escaped by construction. |
| Std.Mail | Email addresses, messages, and SMTP delivery. |
Applications and databases
The pieces a service is assembled from: configuration, health, sessions, jobs, and SQL databases.
| Std.App | An application as a value: settings, stages, health, sessions, and jobs. |
| Std.Db | SQL for SQLite and PostgreSQL: queries, migrations, and stores. |
| Std.Crypto | Hashes, message authentication, key derivation, and encryption. |
| Std.RateLimiter | Token-bucket rate limiting. |
Concurrency
Parallel workers, the channels between them, and the state they share.
| Std.Concurrent | Starting parallel workers and joining them. |
| Std.Channel | Bounded channels between workers. |
| Std.Sync | Mutexes and shared cells. |
Interfaces, audio, and video
Drawing, layout, desktop windows, and exact audio and video timing, written in Pudu itself.
Testing and measuring
Suites that `pudu test` runs, generated properties, and benchmarks.
