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 packages in the Trifle group 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.

For example, this command adds the command-line argument parser:

whim add git+ssh://[email protected]/trifle/args

The group includes:

The Trifle group lists all official packages.

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.