I’m introducing krarup, a dialect of Erlang meant to quickly prototype concurrent data processing. This partly is inspired by a Code BEAM 2024 Keynote and from trying to build either one-off scripts, prototype concurrent processing for quick measurements, and adding concurrent processing to production applications. I found myself reaching for the same boilerplate in each case, and at times throwing my hands up and reaching for Elixir’s Task module.
So as an experiment I wondered two things. The first was: if I were to look at Erlang from scratch as a beginner coming from other languages, what would I expect to reach for? The second was: what if the boiler plate I was using to spawn and link processes through the BIFs were built into the language itsself.
Here is an example of krarup, which currently just adds a handful of keywords:
-module(krarup_example).
-export([main/0]).
% Functions annotated with 'async' spawn a new process.
async add(A, B) -> A + B.
main() ->
% 'await' then waits for all responses from 'async' function calls.
await [add(1, 2), add(3, 4)].
> krarup_example:main().
[3, 7]
It is still in the very early stages, but I’ve build some minor tools for one-off tasks using krarup and I’ve found it useful so far. More features, usability, and general implementation improvements are planned. The current implementation is a bit rough, so I wouldn’t recommend using it for something critical quite yet. I do find this syntax helps with chaining together flows of data, and that a series of small krarup applications could compose well together.
Code: GitHub - mpope9/krarup: The krarup language, a dialect of Erlang.
Primer (WIP): krarup/primer.md at main · mpope9/krarup · GitHub
Example rebar3 app: krarup/examples/basic at main · mpope9/krarup · GitHub