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, given_ok_in/3, given_error_in/3, given_some_in/3, given_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 given_ok_in(
{ok, FVE} | {error, FVF},
fun((FVE) -> FVI),
fun((FVF) -> FVI)
) -> FVI.
given_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 given_error_in(
{ok, FVJ} | {error, FVK},
fun((FVJ) -> FVN),
fun((FVK) -> FVN)
) -> FVN.
given_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 given_some_in(gleam@option:option(FVO), fun(() -> FVQ), fun((FVO) -> FVQ)) -> FVQ.
given_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 given_none_in(gleam@option:option(FVR), fun((FVR) -> FVT), fun(() -> FVT)) -> FVT.
given_none_in(Option, Consequence, Alternative) ->
case Option of
{some, Value} ->
Consequence(Value);
none ->
Alternative()
end.