You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import std/num/int32
import std/time/duration
alias io = <ndet,div,console,st<global>>
alias result<a> = either<exception,a>
alias async-resume<a> = result<a> -> io ()
alias initiate<a> = async-resume<a> -> io ()
alias async-resume1<a> = a -> io ()
alias initiate1<a> = async-resume1<a> -> io ()
alias async-resume0 = () -> io ()
alias initiate0 = async-resume0 -> io ()
effect async
ctl await(initiate: initiate<a>): result<a>
fun await1(initiate: initiate1<a>): <async,exn> a
val await-ret = await fn(async-resume) initiate(fn(x) async-resume(Right(x)))
match await-ret
Left(e) -> throw-exn(e)
Right(a) -> return a
fun await0(initiate: initiate0): <async,exn> ()
await1 fn(async-resume) initiate(fn() async-resume(()))
fun wait(dur: duration): <async,exn> ()
await0 fn(res)
set-timeout(res, dur.milli-seconds.int32)
extern set-timeout(cb: () -> io (), ms: int32) : io ()
js inline "setTimeout(#1, #2)"
val async-handler = handler
ctl await(initiate)
initiate(resume)
fun main()
with async-handler
try({ wait(3.seconds) })
()
Output:
file:///home/omer/koka/why-effects/.koka/v3.1.3/js-debug-2828eb/async.mjs:172
return $std_time_timestamp.int_fs_timespan(n, _x4);
^
ReferenceError: $std_time_timestamp is not defined
at file:///home/omer/koka/why-effects/.koka/v3.1.3/js-debug-2828eb/async.mjs:172:11
at Module._open_none1 (file:///home/omer/koka/why-effects/.koka/v3.1.3/js-debug-2828eb/std_core_hnd.mjs:1396:11)
at file:///home/omer/koka/why-effects/.koka/v3.1.3/js-debug-2828eb/async.mjs:169:37
at file:///home/omer/koka/why-effects/.koka/v3.1.3/js-debug-2828eb/std_core_exn.mjs:330:23
at Module._hhandle (file:///home/omer/koka/why-effects/.koka/v3.1.3/js-debug-2828eb/std_core_hnd.mjs:653:37)
at exn_fs__handle (file:///home/omer/koka/why-effects/.koka/v3.1.3/js-debug-2828eb/std_core_exn.mjs:177:24)
at Module.$try (file:///home/omer/koka/why-effects/.koka/v3.1.3/js-debug-2828eb/std_core_exn.mjs:322:10)
at file:///home/omer/koka/why-effects/.koka/v3.1.3/js-debug-2828eb/async.mjs:167:33
at Module._hhandle (file:///home/omer/koka/why-effects/.koka/v3.1.3/js-debug-2828eb/std_core_hnd.mjs:653:37)
at async_fs__handle (file:///home/omer/koka/why-effects/.koka/v3.1.3/js-debug-2828eb/async.mjs:53:24)
Node.js v22.11.0
The text was updated successfully, but these errors were encountered:
Yeah, this happens in the C backend as well with the time libraries. I think it has to do with the main function being split into it's own module at compile time (which is how we handle being able to run test-example- and main functions for the language server / vscode extension).
I'm now on dev branch, commit a7c4292.
Output:
The text was updated successfully, but these errors were encountered: