Packages
A project that aims to fuse the concurrency models of OTP and Javascript to allow the careful user to write concurrent code that runs on both the otp backend and the gleam backend
Retired package: This is fundamentally broken, a new version will be published soon
Current section
Files
Jump to
Current section
Files
src/fused@promise.erl
-module(fused@promise).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/fused/promise.gleam").
-export([await/2, await_list/1, map/2, map_try/2, rescue/2, resolve/1, tap/2, try_await/2]).
-file("src/fused/promise.gleam", 11).
-spec await(FSP, fun((FSP) -> FSR)) -> FSR.
await(A, B) ->
fused@sync@promise:await(A, B).
-file("src/fused/promise.gleam", 15).
-spec await_list(list(FSU)) -> list(FSU).
await_list(Xs) ->
fused@sync@promise:await_list(Xs).
-file("src/fused/promise.gleam", 19).
-spec map(FSZ, fun((FSZ) -> FTB)) -> FTB.
map(A, B) ->
fused@sync@promise:map(A, B).
-file("src/fused/promise.gleam", 23).
-spec map_try({ok, FTD} | {error, FTE}, fun((FTD) -> {ok, FTI} | {error, FTE})) -> {ok,
FTI} |
{error, FTE}.
map_try(Promise, Callback) ->
fused@sync@promise:map_try(Promise, Callback).
-file("src/fused/promise.gleam", 30).
-spec rescue(FTO, fun((gleam@dynamic:dynamic_()) -> FTO)) -> FTO.
rescue(A, B) ->
fused@sync@promise:rescue(A, B).
-file("src/fused/promise.gleam", 34).
-spec resolve(FTR) -> FTR.
resolve(A) ->
fused@sync@promise:resolve(A).
-file("src/fused/promise.gleam", 38).
-spec tap(FTT, fun((FTT) -> any())) -> FTT.
tap(Promise, Callback) ->
fused@sync@promise:tap(Promise, Callback).
-file("src/fused/promise.gleam", 42).
-spec try_await(
{ok, FTX} | {error, FTY},
fun((FTX) -> {ok, FUC} | {error, FTY})
) -> {ok, FUC} | {error, FTY}.
try_await(Promise, Callback) ->
fused@sync@promise:try_await(Promise, Callback).