Skip to content

Instantly share code, notes, and snippets.

@Avaq

Avaq/after.txt Secret

Last active April 13, 2019 16:58
Show Gist options
  • Save Avaq/4d2fa8241093bbb6894dd2bdb3ce004b to your computer and use it in GitHub Desktop.
Save Avaq/4d2fa8241093bbb6894dd2bdb3ce004b to your computer and use it in GitHub Desktop.
Changes to async stack traces in Fluture
file:///home/avaq/dev/fluture/fluture/src/internal/utils.mjs:16
throw x;
^
Error: What is 42?!
at Future (file:///home/avaq/dev/fluture/fluture/test.mjs:6:9)
at Interpreter.Computation$interpret [as _interpret] (file:///home/avaq/dev/fluture/fluture/src/future.mjs:74:14)
at Parallel$run (file:///home/avaq/dev/fluture/fluture/src/parallel.mjs:20:33)
from first application of Future:
at kapot (file:///home/avaq/dev/fluture/fluture/test.mjs:5:20)
at Interpreter.$1 (file:///home/avaq/dev/fluture/fluture/test.mjs:16:5)
at Generator.next (<anonymous>)
from second application of parallel:
at Interpreter.$1 (file:///home/avaq/dev/fluture/fluture/test.mjs:12:32)
at Generator.next (<anonymous>)
at drain (file:///home/avaq/dev/fluture/fluture/src/go.mjs:55:26)
from first application of parallel:
at Interpreter.$1 (file:///home/avaq/dev/fluture/fluture/test.mjs:12:19)
at Generator.next (<anonymous>)
at drain (file:///home/avaq/dev/fluture/fluture/src/go.mjs:55:26)
from first application of go:
at file:///home/avaq/dev/fluture/fluture/test.mjs:9:1
at ModuleJob.run (internal/modules/esm/module_job.js:95:12)
file:///home/avaq/dev/fluture/fluture/src/internal/utils.mjs:40
throw x;
^
Error: What is 42?!
at Computation.Future [as _computation] (file:///home/avaq/dev/fluture/fluture/test.mjs:6:9)
at Computation$interpret [as _interpret] (file:///home/avaq/dev/fluture/fluture/src/future.mjs:122:19)
at Parallel$run (file:///home/avaq/dev/fluture/fluture/src/parallel.mjs:32:34)
from a Future created with the Future constructor:
at kapot (file:///home/avaq/dev/fluture/fluture/test.mjs:5:20)
at Go._generator (file:///home/avaq/dev/fluture/fluture/test.mjs:16:5)
at Generator.next (<anonymous>)
from consuming a Future:
at Parallel$run (file:///home/avaq/dev/fluture/fluture/src/parallel.mjs:32:34)
at Parallel$drain (file:///home/avaq/dev/fluture/fluture/src/parallel.mjs:51:47)
at Timeout.Parallel$res [as _onTimeout] (file:///home/avaq/dev/fluture/fluture/src/parallel.mjs:45:24)
from a Future created with parallel:
at parallel$max (file:///home/avaq/dev/fluture/fluture/src/parallel.mjs:78:41)
at bound1 (file:///home/avaq/dev/fluture/fluture/src/internal/utils.mjs:15:22)
at Go._generator (file:///home/avaq/dev/fluture/fluture/test.mjs:12:32)
from consuming a parallel Future:
at drain (file:///home/avaq/dev/fluture/fluture/src/go.mjs:87:28)
at Timeout.resolved [as _onTimeout] (file:///home/avaq/dev/fluture/fluture/src/go.mjs:66:14)
at ontimeout (timers.js:438:13)
from a Future created with parallel:
at parallel$max (file:///home/avaq/dev/fluture/fluture/src/parallel.mjs:78:41)
at bound1 (file:///home/avaq/dev/fluture/fluture/src/internal/utils.mjs:15:22)
at Go._generator (file:///home/avaq/dev/fluture/fluture/test.mjs:12:32)
from a Future created with after:
at after$time (file:///home/avaq/dev/fluture/fluture/src/after.mjs:51:38)
at bound1 (file:///home/avaq/dev/fluture/fluture/src/internal/utils.mjs:15:22)
at Go._generator (file:///home/avaq/dev/fluture/fluture/test.mjs:11:30)
from a Future created with do-notation:
at go (file:///home/avaq/dev/fluture/fluture/src/go.mjs:105:10)
at file:///home/avaq/dev/fluture/fluture/test.mjs:9:1
at ModuleJob.run (internal/modules/esm/module_job.js:95:12)
from interpreting a Future created with do-notation:
at Go.Future$value [as value] (file:///home/avaq/dev/fluture/fluture/src/future.mjs:72:16)
at value$cont (file:///home/avaq/dev/fluture/fluture/src/dispatchers/value.mjs:8:12)
at bound1 (file:///home/avaq/dev/fluture/fluture/src/internal/utils.mjs:15:22)
node --experimental-modules --no-warnings --stack-trace-limit=3 index.mjs
import {Future, after, hook, resolve, value, debugMode, parallel, go} from '.';
debugMode (true)
const kapot = x => Future((rej, res) => {
throw new Error(`What is ${x}?!`)
})
go (function*(){
const a = yield resolve (42)
const b = yield after (20) (a / 2)
const c = yield parallel (2) ([
resolve (b + 21),
after (20) (42),
after (40) (42),
kapot (42),
])
return c
})
.pipe (value (console.log))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment