Events continuations

Events continuations are the fundamental building blocks of Koru. An event continuations declares its input payload and possible output branches.

Event Declaration

An event is declared with tor. A branch that carries a single value names its payload type directly:

tor greet { name: string }
| greeting string
| error string

Implementation

A subflow provides the implementation for an event — it produces one of the declared branches:

greet => greeting "Hello, " ++ name ++ "!"

Invoking Events

Events are invoked with flows:

import std/io

greet(name: "World")
| greeting g |> std/io:print.ln(g)
| error e |> std/io:print.ln(e)

More documentation coming soon…