Dever v0.0.2

This commit is contained in:
Codex committed 2026-11-27 06:03:56 +00:00
commit e6e175ebcf
816 files changed
+120349

No files matched your search

+87
View File
@@ -0,0 +1,87 @@
flow delay(value: Int) (out: Int)
| step | kind | do |
| - | flow | dever.time.sleep(value) |
| out | calc | value |
identity(value: Int) (out: Int) { out = value }
rule chosen(yes: Bool, millis: Int) (out: Int)
| yes | millis | out |
| true | - | delay(millis) |
| false | - | 7 |
loop eachDelay(values: List<Int>) (out: List<Int>)
| each value in values | result |
| out | list delay(value) |
rule advance(state: Int) (out: Walk<Int, Int>)
| state | out |
| < 3 | Next(state, state + 1) |
| >= 3 | Done |
flow next(state: Int) (out: Walk<Int, Int>)
| step | kind | do |
| - | flow | dever.time.sleep(state) |
| out | rule | advance(state) |
loop walked() (out: List<Int>)
| each value in walk(0, next) | result |
| out | list value |
flow apply(value: Int, transform: handler(value: Int) (out: Int)) (out: Int)
| step | kind | do |
| out | calc | transform(value) |
flow handled() (out: Int)
| step | kind | do |
| out | flow | apply(1, delay) |
type Attempt {
Done
error Failed(value: dever.time.SleepResult)
}
rule resolve(value: Attempt) (out: Int) recover("invalid duration is explicitly reported as -1")
| value | out |
| Done | 1 |
| Failed(error) | -1 |
flow captured(millis: Int) (out: Int)
| step | kind | do |
| value: Attempt | flow | result(dever.time.sleep(millis)) |
| out | rule | resolve(value) |
measureText(text: Text) (out: Int) { out = length(text) }
flow borrowed(text: Text) (out: Int)
| step | kind | do |
| before | calc | measureText(text) |
| - | flow | dever.time.sleep(1) |
| out | calc | before + measureText(text) |
flow timestamp() (out: DateTime)
| step | kind | do |
| out | flow | dever.time.now() |
flow faultAfterSleep(value: Int) (out: Int)
| step | kind | do |
| - | flow | dever.time.sleep(0) |
| out | calc | value + 1 |
flow update(value: Int, previous: Int) (acc: Int, stop: Bool)
| step | kind | do |
| - | flow | dever.time.sleep(value) |
| acc | calc | previous + value |
| stop | calc | value >= 2 |
loop accumulated(values: List<Int>) (out: Int)
| each value in values | result |
| out | foldUntil(acc = 0, update(value, acc)) |
loop firstDelay(values: List<Int>) (out: Int?)
| each value in values | result |
| out | first delay(value) |
loop walkFrom(seed: Int) (out: List<Int>)
| each value in walk(seed, next) | result |
| out | list value |