1,007 karma · joined October 28, 2010
I implemented a full kernel in rust and compile it to wasm https://github.com/ecto/vcad
Sorry about your mouth!
What if they weren't noids?
You're right, ownership and effects are the real differentiators. The idea here is to let the compiler discover ownership rather than it being declared imperatively
Regarding algebraic effects, Loon uses continuations similar to Koka but more restrictive. Effects are declared with operations, and every side effect (IO, failure, async, state) is an effect that propagates through the call graph. The interesting part is `handle`, which lets you intercept effects:
[handle [load-config "app.toml"]
[IO.read-file path] [resume "mock contents"]
[Fail.fail msg] "default"]
Handling an effect subtracts it from the function's effect setso a function that handles all its IO internally is pure from the outside. This replaces exceptions, async/await, DI, and mocking with one mechanism. Testing is just handling effects with test dataMulti-arity: get lost! fork me?
1. effects are tracked in the type system as row types, so they compose with HM inference pretty naturally. the tricky part is effect polymorphism. Loon handles that similarly to how koka does it, with row polymorphism. no ambiguity issues so far but idk
2. yes, macros are hygienic! documenting some binding situations would make a great first PR :)
3. easier to type!
[type Shape
[Circle Float]
[Rect Float Float]]
[fn area [s]
[match s
[Circle r] => [* 3.14 r r]
[Rect w h] => [* w h]]]
[area [Circle 5.0]]