Packages

Lazily initialised constants for Gleam

Current section

Files

Jump to
lazy_const src lazy_const.erl
Raw

src/lazy_const.erl

-module(lazy_const).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([defined_in/1, new/2]).
-export_type([id/1]).
-opaque id(FSV) :: {id, fun(() -> FSV)}.
-file("/home/arkan/Projects/private/lazy_const/src/lazy_const.gleam", 100).
-spec defined_in(fun(() -> FSW)) -> id(FSW).
defined_in(Wrapper_function) ->
{id, Wrapper_function}.
-file("/home/arkan/Projects/private/lazy_const/src/lazy_const.gleam", 108).
-spec new(id(FSY), fun(() -> FSY)) -> FSY.
new(Wrapper_function, Inner_fn) ->
lazy_const_ffi:new(erlang:element(2, Wrapper_function), Inner_fn).