Skip to content

Latest commit

 

History

History
18 lines (11 loc) · 1.09 KB

README.md

File metadata and controls

18 lines (11 loc) · 1.09 KB

Example code for hooking up a libuv event loop based asynchronous runtime with the Idris dependently typed programming language's C backend.

> # set up build environment and start a shell in it
> nix-shell

$ # build the project
$ sh build.sh

$ # run it
$ out/example1

The goal is to provide a simple nodejs-like API for asynchronous programming, while reaping all the benefits of a dependently typed language and compiling to native code.

Since it can be cumbersome to install Haskell and its tools, Idris, and C depenencies, not to mention they can conflict with other installed versions, in your system, we use a nix development environment to set up an immutable, reproducible, isolated environment for the project. All that is required is a few lines in default.nix.

You can see the how the build process works in build.sh

In order to avoid setting up two Idris VMs, the main() function is in C. It sets up a libuv event loop and an Idris VM, and then calls idris_main.