Language guide
The language guide covers all of Lask, one topic per page. Each topic is a small, complete project: a main.lask whose comments explain the code next to them, and a few commands to run while you read.
If you haven't yet, start with Getting started, Your first real task file and Core concepts. This guide assumes you know what a task, an environment and lask sync are.
How to try a topic
Every topic lives in the lask repository, under example/02-language/. Clone it once:
git clone https://github.com/lask-task-runner/lask.git
cd lask/example/02-language/02-functions
lask check
lask eval greet alice --prefix hiMost topics are a single file. For those, you can also paste the source shown on the page into a main.lask in an empty directory. The topic page says when it has more than one file.
Topics marked "Lask only" in the table run no commands, so they need no Docker. For the others, run lask sync in the topic's directory before the first run or eval, to pull the images it uses.
In the commands on each page, eval prints a task's return value, so you can see what it computed. run prints only the command log, on stderr.
Topics
The table is in reading order. The first three topics are the language itself; Environments and Commands are what make it a task runner; the rest build on those.
| Topic | Covers | Needs |
|---|---|---|
| Values and types | Bindings, annotations, type aliases, records, maps, unions, optional fields, generics, cast | Lask only |
| Functions | Positional, variadic and keyword parameters, lambdas, higher-order functions, |> and >> | Lask only |
| Control flow | do, if with and without else, c ? a : b, all three forms of case, for | Lask only |
| Execution environments | #local, tags, digests, run options and runnable, a Dockerfile recipe, environments as values | Docker |
| Commands | $, $1, $2, $*, interpolation and its escaping, raw holes #!{...}, dispatch, run | Docker |
| Concurrency | async / await, spawn, all, race | Docker |
| Errors | try / catch / finally, fail, error, recover, exit codes | Docker |
| Modules and imports | Named and namespace imports, internal, re-export, per-module command declarations | Docker for the last task only |
| External dependencies | lask.json, the committed lock file, importing a shared module by name, lask deps | Docker, and one network step |
| The built-in library | Numbers, strings, regular expressions, arrays, maps | Lask only |
| Structured data | JSON, YAML, TOML, CSV, dotenv, cast, hashes, base64 | Lask only |
| Input, output and secrets | stdin, the stdout contract, get_env and friends, !!, log | Docker for the two secret tasks only |
| Files and paths | read_file / write_file / glob and the environment each one names | Docker for two tasks; the rest run on #local |
| Documentation and the command line | Doc comments, @param, @complete, @hidden, and how a signature becomes a command line | Lask only |
The Quick reference covers the same ground on one page, and the specification has the exact rules.