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
fused src fused@promise.erl
Raw

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(FUD, fun((FUD) -> FUF)) -> FUF.
await(A, B) ->
fused@sync@promise:await(A, B).
-file("src/fused/promise.gleam", 15).
-spec await_list(list(FUI)) -> list(FUI).
await_list(Xs) ->
fused@sync@promise:await_list(Xs).
-file("src/fused/promise.gleam", 19).
-spec map(FUN, fun((FUN) -> FUP)) -> FUP.
map(A, B) ->
fused@sync@promise:map(A, B).
-file("src/fused/promise.gleam", 23).
-spec map_try({ok, FUR} | {error, FUS}, fun((FUR) -> {ok, FUW} | {error, FUS})) -> {ok,
FUW} |
{error, FUS}.
map_try(Promise, Callback) ->
fused@sync@promise:map_try(Promise, Callback).
-file("src/fused/promise.gleam", 30).
-spec rescue(FVC, fun((gleam@dynamic:dynamic_()) -> FVC)) -> FVC.
rescue(A, B) ->
fused@sync@promise:rescue(A, B).
-file("src/fused/promise.gleam", 34).
-spec resolve(FVF) -> FVF.
resolve(A) ->
fused@sync@promise:resolve(A).
-file("src/fused/promise.gleam", 38).
-spec tap(FVH, fun((FVH) -> any())) -> FVH.
tap(Promise, Callback) ->
fused@sync@promise:tap(Promise, Callback).
-file("src/fused/promise.gleam", 42).
-spec try_await(
{ok, FVL} | {error, FVM},
fun((FVL) -> {ok, FVQ} | {error, FVM})
) -> {ok, FVQ} | {error, FVM}.
try_await(Promise, Callback) ->
fused@sync@promise:try_await(Promise, Callback).