Current section
Files
Jump to
Current section
Files
src/given.erl
-module(given).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([that/3, any/3, all/3, 'not'/3, not_any/3, not_all/3, 'when'/3, when_not/3, empty/3, non_empty/3, ok/3, any_ok/3, all_ok/3, error/3, any_error/3, all_error/3, some/3, any_some/3, all_some/3, none/3, any_none/3, all_none/3]).
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 41).
-spec that(boolean(), fun(() -> FDG), fun(() -> FDG)) -> FDG.
that(Requirement, Consequence, Alternative) ->
case Requirement of
true ->
Consequence();
false ->
Alternative()
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 81).
-spec any(list(boolean()), fun(() -> FDI), fun(() -> FDI)) -> FDI.
any(Requirements, Consequence, Alternative) ->
case begin
_pipe = Requirements,
gleam@list:any(_pipe, fun(V) -> V =:= true end)
end of
true ->
Consequence();
false ->
Alternative()
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 120).
-spec all(list(boolean()), fun(() -> FDK), fun(() -> FDK)) -> FDK.
all(Requirements, Consequence, Alternative) ->
case begin
_pipe = Requirements,
gleam@list:all(_pipe, fun(V) -> V =:= true end)
end of
true ->
Consequence();
false ->
Alternative()
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 169).
-spec 'not'(boolean(), fun(() -> FDL), fun(() -> FDL)) -> FDL.
'not'(Requirement, Consequence, Alternative) ->
case Requirement of
false ->
Consequence();
true ->
Alternative()
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 209).
-spec not_any(list(boolean()), fun(() -> FDN), fun(() -> FDN)) -> FDN.
not_any(Requirements, Consequence, Alternative) ->
case begin
_pipe = Requirements,
gleam@list:any(_pipe, fun(V) -> V =:= true end)
end of
false ->
Consequence();
true ->
Alternative()
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 248).
-spec not_all(list(boolean()), fun(() -> FDP), fun(() -> FDP)) -> FDP.
not_all(Requirements, Consequence, Alternative) ->
case begin
_pipe = Requirements,
gleam@list:all(_pipe, fun(V) -> V =:= true end)
end of
false ->
Consequence();
true ->
Alternative()
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 288).
-spec 'when'(fun(() -> boolean()), fun(() -> FDQ), fun(() -> FDQ)) -> FDQ.
'when'(Condition, Alternative, Consequence) ->
case Condition() of
true ->
Consequence();
false ->
Alternative()
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 328).
-spec when_not(fun(() -> boolean()), fun(() -> FDR), fun(() -> FDR)) -> FDR.
when_not(Condition, Alternative, Consequence) ->
case Condition() of
false ->
Consequence();
true ->
Alternative()
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 355).
-spec empty(list(any()), fun(() -> FDU), fun(() -> FDU)) -> FDU.
empty(List, Alternative, Consequence) ->
case List of
[] ->
Consequence();
_ ->
Alternative()
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 382).
-spec non_empty(list(any()), fun(() -> FDX), fun(() -> FDX)) -> FDX.
non_empty(List, Alternative, Consequence) ->
case List of
[] ->
Alternative();
_ ->
Consequence()
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 420).
-spec ok({ok, FDY} | {error, FDZ}, fun((FDZ) -> FEC), fun((FDY) -> FEC)) -> FEC.
ok(Rslt, Alternative, Consequence) ->
case Rslt of
{ok, Val} ->
Consequence(Val);
{error, Err} ->
Alternative(Err)
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 448).
-spec any_ok(
list({ok, FED} | {error, FEE}),
fun((list(FEE)) -> FEJ),
fun((list(FED), list(FEE)) -> FEJ)
) -> FEJ.
any_ok(Rslts, Alternative, Consequence) ->
{Oks, Errors} = begin
_pipe = Rslts,
gleam@result:partition(_pipe)
end,
case Oks of
[] ->
Alternative(Errors);
_ ->
Consequence(Oks, Errors)
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 478).
-spec all_ok(
list({ok, FEM} | {error, FEN}),
fun((list(FEM), list(FEN)) -> FET),
fun((list(FEM)) -> FET)
) -> FET.
all_ok(Rslts, Alternative, Consequence) ->
{Oks, Errors} = begin
_pipe = Rslts,
gleam@result:partition(_pipe)
end,
case Errors of
[] ->
Consequence(Oks);
_ ->
Alternative(Oks, Errors)
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 518).
-spec error({ok, FEV} | {error, FEW}, fun((FEV) -> FEZ), fun((FEW) -> FEZ)) -> FEZ.
error(Rslt, Alternative, Consequence) ->
case Rslt of
{error, Err} ->
Consequence(Err);
{ok, Val} ->
Alternative(Val)
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 546).
-spec any_error(
list({ok, FFA} | {error, FFB}),
fun((list(FFA)) -> FFG),
fun((list(FFA), list(FFB)) -> FFG)
) -> FFG.
any_error(Rslts, Alternative, Consequence) ->
{Oks, Errors} = begin
_pipe = Rslts,
gleam@result:partition(_pipe)
end,
case Errors of
[] ->
Alternative(Oks);
_ ->
Consequence(Oks, Errors)
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 576).
-spec all_error(
list({ok, FFJ} | {error, FFK}),
fun((list(FFJ), list(FFK)) -> FFQ),
fun((list(FFK)) -> FFQ)
) -> FFQ.
all_error(Rslts, Alternative, Consequence) ->
{Oks, Errors} = begin
_pipe = Rslts,
gleam@result:partition(_pipe)
end,
case Oks of
[] ->
Consequence(Errors);
_ ->
Alternative(Oks, Errors)
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 615).
-spec some(gleam@option:option(FFS), fun(() -> FFU), fun((FFS) -> FFU)) -> FFU.
some(Optn, Alternative, Consequence) ->
case Optn of
{some, Val} ->
Consequence(Val);
none ->
Alternative()
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 643).
-spec any_some(
list(gleam@option:option(FFV)),
fun((integer()) -> FFY),
fun((list(FFV), integer()) -> FFY)
) -> FFY.
any_some(Optns, Alternative, Consequence) ->
{Somes, Nones_count} = begin
_pipe = Optns,
given@internal@lib@optionx:partition(_pipe)
end,
case Somes of
[] ->
Alternative(Nones_count);
_ ->
Consequence(Somes, Nones_count)
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 673).
-spec all_some(
list(gleam@option:option(FGA)),
fun((list(FGA), integer()) -> FGE),
fun((list(FGA)) -> FGE)
) -> FGE.
all_some(Optns, Alternative, Consequence) ->
{Somes, Nones_count} = begin
_pipe = Optns,
given@internal@lib@optionx:partition(_pipe)
end,
case Nones_count of
0 ->
Consequence(Somes);
_ ->
Alternative(Somes, Nones_count)
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 712).
-spec none(gleam@option:option(FGG), fun((FGG) -> FGI), fun(() -> FGI)) -> FGI.
none(Optn, Alternative, Consequence) ->
case Optn of
none ->
Consequence();
{some, Val} ->
Alternative(Val)
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 740).
-spec any_none(
list(gleam@option:option(FGJ)),
fun((list(FGJ)) -> FGN),
fun((list(FGJ), integer()) -> FGN)
) -> FGN.
any_none(Optns, Alternative, Consequence) ->
{Somes, Nones_count} = begin
_pipe = Optns,
given@internal@lib@optionx:partition(_pipe)
end,
case Nones_count of
0 ->
Alternative(Somes);
_ ->
Consequence(Somes, Nones_count)
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 769).
-spec all_none(
list(gleam@option:option(FGP)),
fun((list(FGP), integer()) -> FGT),
fun(() -> FGT)
) -> FGT.
all_none(Optns, Alternative, Consequence) ->
{Somes, Nones_count} = begin
_pipe = Optns,
given@internal@lib@optionx:partition(_pipe)
end,
case Somes of
[] ->
Consequence();
_ ->
Alternative(Somes, Nones_count)
end.