Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Official Packages

The Whim project maintains Trifle packages on Codeberg. They live outside the main Whim repository and do not ship with the standard library.

These packages use names under Trifle\. Their Git tags define their versions. Install them through Whim’s Git package manager.

PackageDescriptionInstall
ansiANSI colours, styles, cursor movement, and screen controls.whim add git+ssh://[email protected]/trifle/ansi
argsTyped command-line parsing and generated usage.whim add git+ssh://[email protected]/trifle/args
cacheStampede-safe local LRU and database caches.whim add git+ssh://[email protected]/trifle/cache
clockClocks and sleep that tests can control.whim add git+ssh://[email protected]/trifle/clock
configTyped configuration from values, files, and the environment.whim add git+ssh://[email protected]/trifle/config
consoleTerminal output, tables, progress, and prompts.whim add git+ssh://[email protected]/trifle/console
cqrsCommand and query buses with events, logs, and traces.whim add git+ssh://[email protected]/trifle/cqrs
cronCron expression parsing and occurrence calculation.whim add git+ssh://[email protected]/trifle/cron
diffMyers diffs for values and text, with unified output.whim add git+ssh://[email protected]/trifle/diff
dotenv.env parsing and environment layering.whim add git+ssh://[email protected]/trifle/dotenv
eventTyped events with hierarchy-aware listeners.whim add git+ssh://[email protected]/trifle/event
expectFluent expectations for tests.whim add git+ssh://[email protected]/trifle/expect
fakeDeterministic fake data generated from a seed.whim add git+ssh://[email protected]/trifle/fake
feedAtom and RSS feed generation.whim add git+ssh://[email protected]/trifle/feed
fnSmall combinators for building transforms.whim add git+ssh://[email protected]/trifle/fn
fuseA circuit breaker with controllable time.whim add git+ssh://[email protected]/trifle/fuse
graphImmutable graphs with traversal and shortest paths.whim add git+ssh://[email protected]/trifle/graph
humanizeHuman-readable durations, sizes, counts, and numbers.whim add git+ssh://[email protected]/trifle/humanize
lockLeased mutual exclusion over pluggable stores.whim add git+ssh://[email protected]/trifle/lock
logStructured logging with composable loggers.whim add git+ssh://[email protected]/trifle/log
markdownCommonMark and GitHub-flavoured Markdown parsing.whim add git+ssh://[email protected]/trifle/markdown
markdown-ansiMarkdown rendering for styled terminal text.whim add git+ssh://[email protected]/trifle/markdown-ansi
markdown-htmlMarkdown rendering for HTML.whim add git+ssh://[email protected]/trifle/markdown-html
moneyInteger money, ISO 4217 currencies, and lossless allocation.whim add git+ssh://[email protected]/trifle/money
otpHOTP, TOTP, and authenticator provisioning.whim add git+ssh://[email protected]/trifle/otp
qrQR code generation with matrix and SVG output.whim add git+ssh://[email protected]/trifle/qr
queueMessage queues with retries, workers, and pluggable stores.whim add git+ssh://[email protected]/trifle/queue
retryRetry policies with delays, jitter, deadlines, and controllable time.whim add git+ssh://[email protected]/trifle/retry
sealSealed payloads and signed JWTs with key rotation.whim add git+ssh://[email protected]/trifle/seal
semverSemantic versions and Cargo-style requirements.whim add git+ssh://[email protected]/trifle/semver
sseServer-sent event encoding and HTTP response bodies.whim add git+ssh://[email protected]/trifle/sse
stateTyped finite state machines.whim add git+ssh://[email protected]/trifle/state
templateLogic-less Mustache templates rendered from JSON values.whim add git+ssh://[email protected]/trifle/template
themePaints and themes for terminal text.whim add git+ssh://[email protected]/trifle/theme
throttleKeyed token-bucket and fixed-window rate limits.whim add git+ssh://[email protected]/trifle/throttle
traceTimed spans recorded through structured logs.whim add git+ssh://[email protected]/trifle/trace
treeImmutable trees with traversal, search, and folds.whim add git+ssh://[email protected]/trifle/tree

Codeberg hosts all Trifle package repositories.

After you add Trifle\Diff and load vendor/autoload.whim, you can compare two sequences:

use Trifle\Diff;
use Trifle\Diff\Operation;

$edits = Diff\diff::<string>(vec['a', 'b', 'c'], vec['a', 'c', 'd']);

foreach ($edits as $edit) {
  $marker = match ($edit->operation) {
    Operation::Keep => ' ',
    Operation::Delete => '-',
    Operation::Insert => '+',
  };

  write_line!($marker . ' ' . $edit->value);
}

See Git Dependencies for manifests, locks, updates, and autoloading.