btbytes / 1-hello-world

OCaml Riot Example Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1-hello-world

A project so basic that fits on a single line!

Riot.run @@ fun () -> print_endline "Hello, Joe!"

Every Riot program begins with a call to Riot.run. Riot.run takes a single function as input, and does not terminate. This is because Riot programs are expected to run forever.

If you want to terminate the Riot runtime, you can call Riot.shutdown () from anywhere in the program. Keep in mind that this will not await for all processes to terminate. We will cover graceful-shutdowns of applications later in this tutorial.

Riot.run @@ fun () ->
    print_endline "Hello, Joe!";
    Riot.shutdown ()

The smallest Riot program, that starts and ends immediately, is then:

Riot.(run shutdown)

Next Steps

About

OCaml Riot Example Project


Languages

Language:Makefile 52.8%Language:OCaml 47.2%