Clocky is a very-WIP functional-reactive programming language with type-level clocks. It's primarily inspired by Async RaTT and Rhine.
The idea is to eventually allow audio programming that can mix high-level control with low-level synthesis and analysis. Performance is nowhere near good enough for that yet, though.
Clocky is currently implemented with a bespoke compiler to WebAssembly. You can play with the language in its sketchbook interface.
Let's start by looking at the type of that classic functional building block, map
:
for a : type. for b : type. for k : clock.
[](a -> b) -> ~^(k) a -> ~^(k) b
In a more mathematical notation, we might write the body of that type as
Accessing further parts of a stream is something we can only do later, but there are some things we can only do now, like accessing a function we have lying around: that function might depend on precisely-timed streams! This is why map
needs a "boxed" function
Install a Rust nightly toolchain for both your host architecture as well as wasm32-unknown-unknown, then run
cargo +nightly -Z bindeps build --release
To build the sketchbook interface, install wasm-pack and npm, then run
wasm-pack build
cd sketching
npm run build