Current section
Files
Jump to
Current section
Files
src/gextra@result.erl
-module(gextra@result).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([lazy_map_both/3, lazy_try_both/3, use_lazy_map_both/2, try_lazy_map_both/2, map_both/3, try_both/3, use_map_both/2, try_map_both/2]).
-file("/home/joe/Projects/gleam/utils/src/gextra/result.gleam", 22).
-spec lazy_map_both(
{ok, GEJ} | {error, GEK},
fun((GEK) -> GEN),
fun((GEJ) -> GEO)
) -> {ok, GEO} | {error, GEN}.
lazy_map_both(R, Err, Val) ->
case R of
{ok, V} ->
_pipe = Val(V),
{ok, _pipe};
{error, E} ->
_pipe@1 = Err(E),
{error, _pipe@1}
end.
-file("/home/joe/Projects/gleam/utils/src/gextra/result.gleam", 53).
-spec lazy_try_both(
{ok, GER} | {error, GES},
fun((GES) -> GEV),
fun((GER) -> {ok, GEW} | {error, GEV})
) -> {ok, GEW} | {error, GEV}.
lazy_try_both(R, Err, Val) ->
case R of
{ok, V} ->
Val(V);
{error, E} ->
_pipe = Err(E),
{error, _pipe}
end.
-file("/home/joe/Projects/gleam/utils/src/gextra/result.gleam", 64).
-spec use_lazy_map_both({ok, GFB} | {error, GFC}, fun((GFC) -> GFF)) -> fun((fun((GFB) -> GHR)) -> {ok,
GHR} |
{error, GFF}).
use_lazy_map_both(R, Err) ->
gextra@function:pipe2(fun lazy_map_both/3, R, Err).
-file("/home/joe/Projects/gleam/utils/src/gextra/result.gleam", 68).
-spec try_lazy_map_both({ok, GFH} | {error, GFI}, fun((GFI) -> GFL)) -> fun((fun((GFH) -> {ok,
GHZ} |
{error, GFL})) -> {ok, GHZ} | {error, GFL}).
try_lazy_map_both(R, Err) ->
gextra@function:pipe2(fun lazy_try_both/3, R, Err).
-file("/home/joe/Projects/gleam/utils/src/gextra/result.gleam", 82).
-spec map_both({ok, GFN} | {error, any()}, GFR, fun((GFN) -> GFS)) -> {ok, GFS} |
{error, GFR}.
map_both(R, Err, Val) ->
case R of
{ok, V} ->
_pipe = Val(V),
{ok, _pipe};
{error, _} ->
_pipe@1 = Err,
{error, _pipe@1}
end.
-file("/home/joe/Projects/gleam/utils/src/gextra/result.gleam", 103).
-spec try_both(
{ok, GFV} | {error, any()},
GFZ,
fun((GFV) -> {ok, GGA} | {error, GFZ})
) -> {ok, GGA} | {error, GFZ}.
try_both(R, Err, Val) ->
case R of
{ok, V} ->
Val(V);
{error, _} ->
_pipe = Err,
{error, _pipe}
end.
-file("/home/joe/Projects/gleam/utils/src/gextra/result.gleam", 114).
-spec use_map_both({ok, GGF} | {error, any()}, GGJ) -> fun((fun((GGF) -> GJA)) -> {ok,
GJA} |
{error, GGJ}).
use_map_both(R, Err) ->
gextra@function:pipe2(fun map_both/3, R, Err).
-file("/home/joe/Projects/gleam/utils/src/gextra/result.gleam", 118).
-spec try_map_both({ok, GGL} | {error, any()}, GGP) -> fun((fun((GGL) -> {ok,
GJI} |
{error, GGP})) -> {ok, GJI} | {error, GGP}).
try_map_both(R, Err) ->
gextra@function:pipe2(fun try_both/3, R, Err).