Current section

Files

Jump to
given src given.erl
Raw

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("/Users/leo/Documents/together/toyland/new/lib_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("/Users/leo/Documents/together/toyland/new/lib_given/src/given.gleam", 50).
-spec not_given(boolean(), fun(() -> FVD), fun(() -> FVD)) -> FVD.
not_given(Requirement, Consequence, Alternative) ->
case not Requirement of
true ->
Consequence();
false ->
Alternative()
end.
-file("/Users/leo/Documents/together/toyland/new/lib_given/src/given.gleam", 69).
-spec ok_in({ok, FVE} | {error, FVF}, fun((FVE) -> FVI), fun((FVF) -> FVI)) -> FVI.
ok_in(Result, Alternative, Consequence) ->
case Result of
{ok, Value} ->
Alternative(Value);
{error, Error} ->
Consequence(Error)
end.
-file("/Users/leo/Documents/together/toyland/new/lib_given/src/given.gleam", 88).
-spec error_in({ok, FVJ} | {error, FVK}, fun((FVJ) -> FVN), fun((FVK) -> FVN)) -> FVN.
error_in(Result, Consequence, Alternative) ->
case Result of
{ok, Value} ->
Consequence(Value);
{error, Error} ->
Alternative(Error)
end.
-file("/Users/leo/Documents/together/toyland/new/lib_given/src/given.gleam", 107).
-spec some_in(gleam@option:option(FVO), fun(() -> FVQ), fun((FVO) -> FVQ)) -> FVQ.
some_in(Option, Consequence, Alternative) ->
case Option of
{some, Value} ->
Alternative(Value);
none ->
Consequence()
end.
-file("/Users/leo/Documents/together/toyland/new/lib_given/src/given.gleam", 126).
-spec none_in(gleam@option:option(FVR), fun((FVR) -> FVT), fun(() -> FVT)) -> FVT.
none_in(Option, Consequence, Alternative) ->
case Option of
{some, Value} ->
Consequence(Value);
none ->
Alternative()
end.