What I've been working on recently: an effect-oriented homemade language that compiles to WASM / JS / C.
I'm in the middle of adding a package manager and adding more language features.
https://github.com/emela-lang/emela
https://docs.emela.dev
Looks like:
emel
import Std.Console.{Console}
import Std.Platform.{Platform}
error Negative(n: Int)
fn half(n: Int) -> Int fails Negative {
if n < 0 { fail Negative(n:) }
n / 2
}
fn main() {
with Platform {
console = use Console
[10, -4, 7]
|> List.map(fn(n) { Int.to_string(half(n)) escape { Negative(n:) -> "#{n} is negative" } })
|> String.join(", ")
|> console.print_line
}
}sh
$ emela run main.emel 5, -4 is negative, 3
Translated from Japanese
GitHubGitHub - emela-lang/emela: Experimental "first-class effect" supported functional programming language that compiles to WebAssembly / JavaScript / CExperimental "first-class effect" supported functional programming language that compiles to WebAssembly / JavaScript / C - emela-lang/emela
commit 5b0c1d1