Leema is designed for concurrency and asynchronous I/O.

Imagine the case where you want to make two database queries. In Leema, the sequential version would look something like:

let users := fetch_users_from_db()
let products := fetch_products_from_db()
process_users_and_products(users, products)

The asynchronous version would look like:

let users_fork := task.fork(fetch_users_from_db())
let products_fork := task.fork(fetch_products_from_db())
let users := task.join_fork(users_fork)
let products := task.join_fork(products_fork)
process_users_and_products(users, products)

With the task.fork call, the expressions assigned to users and products are executed asynchronously.

The code to join the futures still needs to be improved so that joining asynchronous results isn’t quite as verbose.