diff options
author | Louis Pilfold <louis@lpil.uk> | 2019-04-14 13:03:24 +0000 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-04-14 13:03:32 +0000 |
commit | 8cfa606f3834cf7d05f5011bc68295a9d84263dc (patch) | |
tree | fa7edc8ea53426b072f35d3d61e0ab821c8d5feb /gen/src/any.erl | |
parent | ae5597c1b27982aabe74eb16d5b0c890802730d9 (diff) | |
download | gleam_stdlib-8cfa606f3834cf7d05f5011bc68295a9d84263dc.tar.gz gleam_stdlib-8cfa606f3834cf7d05f5011bc68295a9d84263dc.zip |
stdlib: Split out tests
Diffstat (limited to 'gen/src/any.erl')
-rw-r--r-- | gen/src/any.erl | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/gen/src/any.erl b/gen/src/any.erl new file mode 100644 index 0000000..62f1a77 --- /dev/null +++ b/gen/src/any.erl @@ -0,0 +1,46 @@ +-module(any). +-compile(no_auto_import). + +-export([from/1, unsafeCoerce/1, string/1, int/1, float/1, atom/1, bool/1, thunk/1, list/2, tuple/1, field/2]). + +list_module() -> + list. + +from(A) -> + gleam__stdlib:identity(A). + +unsafeCoerce(A) -> + gleam__stdlib:identity(A). + +string(A) -> + gleam__stdlib:decode_string(A). + +int(A) -> + gleam__stdlib:decode_int(A). + +float(A) -> + gleam__stdlib:decode_float(A). + +atom(A) -> + gleam__stdlib:decode_atom(A). + +bool(A) -> + gleam__stdlib:decode_bool(A). + +thunk(A) -> + gleam__stdlib:decode_thunk(A). + +list_any(A) -> + gleam__stdlib:decode_list(A). + +list(Any, Decode) -> + result:then(list_any(Any), + fun(Capture1) -> + (list_module()):traverse(Capture1, Decode) + end). + +tuple(A) -> + gleam__stdlib:decode_tuple(A). + +field(A, B) -> + gleam__stdlib:decode_field(A, B). |