Open rmhsilva opened 4 years ago
Is your feature request related to a problem? Please describe.
Often, I want to pass a Python function around (e.g. to map), but always call it asynchronously. Currently, the only way to do that is wrap it:
map
fn foo_async(x) { async foo(x) } // ... map(foo_async, items)
Where map takes a function pointer.
Describe the solution you'd like
I'd like to be able to do:
map(async foo, items)
Implementation
At compile-time, async foo should create a new https://wiki.haskell.org/Lifting version of foo which always runs asynchronously. This could work similar to the import lifting (see wrap_foreign_function in https://github.com/condense9/teal-lang/blob/master/src/hark_lang/hark_compiler/compiler.py).
async foo
foo
wrap_foreign_function
The parser rules would need to be modified too.
Is your feature request related to a problem? Please describe.
Often, I want to pass a Python function around (e.g. to
map
), but always call it asynchronously. Currently, the only way to do that is wrap it:Where
map
takes a function pointer.Describe the solution you'd like
I'd like to be able to do:
Implementation
At compile-time,
async foo
should create a new https://wiki.haskell.org/Lifting version offoo
which always runs asynchronously. This could work similar to the import lifting (seewrap_foreign_function
in https://github.com/condense9/teal-lang/blob/master/src/hark_lang/hark_compiler/compiler.py).The parser rules would need to be modified too.