The omegyu command
The commands and options of omegyu, the command-line tool that checks, normalises, runs and formats Omegyu programs and compiles contracts.
omegyu checks, normalises, runs and formats Omegyu programs, and compiles
contracts to EVM bytecode. In a checkout of the repository, nix develop
provides the tools and just build builds everything. nix run . -- --help
runs the executable, and nix build builds it and runs its tests.
Commands
| Command | What it does |
|---|---|
omegyu type | prints the type of an expression |
omegyu normalize | prints the normal form of an expression |
omegyu elaborate | prints the kernel term that an expression elaborates to, with everything that was inferred |
omegyu run | runs a program: an expression of type IO a |
omegyu parse | prints the syntax tree of an expression |
omegyu format | formats source files |
omegyu highlight | prints a source with syntax highlighting |
omegyu freeze | pins the imports of files to the hashes of what they check to |
omegyu repl | evaluates expressions interactively |
omegyu evm build | compiles a contract to EVM bytecode |
omegyu evm plan | prints a measured deployment plan, without sending transactions |
type, normalize, elaborate, run, parse and highlight read a
file, the standard input when the file is - or missing, or an expression
given with -e or --expr:
$ omegyu type -e '\(n : Natural) -> n + 1'
Natural -> Natural
$ omegyu normalize -e 'std:List.map (\(n : Natural) -> n + 1) [ 1, 2, 3 ]'
[ 2, 3, 4 ]omegyu run FILE ARGS… gives the arguments after -- to the program, which
reads them with IO/args:
$ omegyu run examples/fizzbuzz.omg -- 5
1
2
Fizz
4
BuzzOptions
Every command accepts these options:
| Option | Effect |
|---|---|
--color WHEN | colours the output: auto, the default, colours it on a terminal unless NO_COLOR is set; always and never decide for it |
--unicode | prints code with the Unicode symbols, such as λ, → and ∀ |
--width COLUMNS | lays out code for lines of this width; the default is 100 |
--no-cache | neither reads nor writes the cache of checked modules; OMEGYU_CACHE=off does the same |
--recheck | has the kernel check again what is read from the cache |
omegyu --version prints the version, and --help after a command prints
its options.
Formatting
omegyu format FILES… prints each file formatted, or the standard input
when no file is given. -i or --inplace rewrites the files instead, and
--check prints no source and fails when a file is not formatted.
--unicode writes the Unicode symbols.
$ omegyu format -e 'let x = 1 in x'
let x = 1 in x
$ omegyu format --check messy.omg
error: messy.omg: not formattedFreezing imports
omegyu freeze FILES… writes after each import the hash of the module that
it checks to, and updates the hashes that changed. --check changes
nothing, and fails when an import is not pinned to the hash of what it
checks to. Imports and the cache describes
hashes.
The REPL
omegyu repl reads expressions and definitions:
| Input | Effect |
|---|---|
| an expression | evaluates it, and carries it out when it is an action |
let x = e | defines x for the rest of the session |
:type e, :t e | prints the type of e |
:reset | forgets the definitions of the session |
:help, :h, :? | prints the commands |
:quit, :q, Ctrl-D | leaves |
Each input is checked as the program made of it and of the definitions that it refers to. Tab after a dot completes the fields of a record and the constructors of a union.
Contracts
omegyu evm build FILE compiles a contract, and omegyu evm plan FILE
prints its deployment plan. The EVM back end
describes them and their options.
Exit status and environment
omegyu exits with 0 when the command succeeds, and with 1 when it fails,
after printing the diagnostics on the standard error. omegyu run exits
with the status that the program gives to IO/exit.
| Variable | Effect |
|---|---|
OMEGYU_CACHE | the directory of the cache, or off to turn it off |
XDG_CACHE_HOME | when OMEGYU_CACHE is not set, the cache is in omegyu under this directory, by default ~/.cache |
NO_COLOR | turns colours off under --color auto |