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([given/3, not_given/3, ok_in/3, error_in/3, some_in/3, none_in/3]).
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 26).
-spec given(boolean(), fun(() -> FVC), fun(() -> FVC)) -> FVC.
given(Requirement, Consequence, Alternative) ->
case Requirement of
true ->
Consequence();
false ->
Alternative()
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 51).
-spec not_given(boolean(), fun(() -> FVD), fun(() -> FVD)) -> FVD.
not_given(Requirement, Consequence, Alternative) ->
case Requirement of
false ->
Consequence();
true ->
Alternative()
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 71).
-spec ok_in({ok, FVE} | {error, FVF}, fun((FVF) -> FVI), fun((FVE) -> FVI)) -> FVI.
ok_in(Rslt, Alternative, Consequence) ->
case Rslt of
{ok, Val} ->
Consequence(Val);
{error, Err} ->
Alternative(Err)
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 91).
-spec error_in({ok, FVJ} | {error, FVK}, fun((FVJ) -> FVN), fun((FVK) -> FVN)) -> FVN.
error_in(Rslt, Alternative, Consequence) ->
case Rslt of
{error, Err} ->
Consequence(Err);
{ok, Val} ->
Alternative(Val)
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 111).
-spec some_in(gleam@option:option(FVO), fun(() -> FVQ), fun((FVO) -> FVQ)) -> FVQ.
some_in(Optn, Alternative, Consequence) ->
case Optn of
{some, Val} ->
Consequence(Val);
none ->
Alternative()
end.
-file("/Volumes/Gleam/gleam-given/src/given.gleam", 131).
-spec none_in(gleam@option:option(FVR), fun((FVR) -> FVT), fun(() -> FVT)) -> FVT.
none_in(Optn, Alternative, Consequence) ->
case Optn of
none ->
Consequence();
{some, Val} ->
Alternative(Val)
end.