-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
In https://doc.flix.dev/main.html, it says:
The entry point of any Flix program is the main function which must have the signature:
def main(): Unit \ IO
However, to get the following to run I had to add NonDet, so I wonder if there are other effects that can be added to the signature of main().
mod Time {
pub def ofDay(): Int64 \ Clock =
Clock.currentTime(TimeUnit.Milliseconds)
}
mod Rand {
pub def number(): Int64 \ Random =
Random.randomInt64()
}
def add(x: a, y: a): a with Add[a] = x + y
def divide(x: a, y: a): a with Div[a] = x / y
def g(a: Int64, b: Int64): Int64 \ {Clock, Random} =
let x = add(a, Time.ofDay());
let y = divide(b, Rand.number());
add(x, y)
def main(): Unit \ {IO, NonDet} =
run {
println(g(11i64, 42i64))
} with Clock.runWithIO with Random.runWithIO
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels