APIRuntime.Entry

Runtime.Entry

Program entry assembly: the default handlers main’s effects run under.

An effect names the runner a program uses for it when nothing else handles it, with a DefaultHandler attribute that quotes the runner:

#[Runtime.Entry.DefaultHandler `runSystem`]
effect Environment
    args : () -> List String

When main performs effects besides IO, the compiler splices assemble to build the program entry: main, nested inside the default runner of every effect it performs and of every effect those runners perform in turn. A default applies nowhere else, so a missing handler in ordinary code is still a compile error.

DefaultHandler

type DefaultHandler = DefaultHandler CodeSource

The runner the program entry installs for the effect this attribute precedes. The quote names a runner of shape (() ->{E, e} a) ->{R…, e} a, where E is the effect and the labels R… are only IO and effects that declare default handlers themselves. An effect declares at most one.

Constructors

DefaultHandler

DefaultHandler : Code -> DefaultHandlerSource

The quoted runner.

assemble

assemble : TypeRepr -> Code -> CodeSource

The program entry for main, given its type and a reference to it. Failures point at the offending attribute or at main.