-module(go_over@util). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([iff/3, iffnil/2, throwaway/2]). -spec iff(boolean(), fun(() -> MLY), MLY) -> MLY. iff(V, F, Default) -> case V of true -> F(); _ -> Default end. -spec iffnil(boolean(), fun(() -> nil)) -> nil. iffnil(V, F) -> iff(V, F, nil). -spec throwaway(boolean(), fun(() -> {ok, any()} | {error, any()})) -> nil. throwaway(V, F) -> case V of true -> _ = F(), nil; _ -> nil end.