diff options
Diffstat (limited to 'gen/src')
-rw-r--r-- | gen/src/std@any.erl (renamed from gen/src/any.erl) | 12 | ||||
-rw-r--r-- | gen/src/std@atom.erl (renamed from gen/src/atom.erl) | 2 | ||||
-rw-r--r-- | gen/src/std@bool.erl (renamed from gen/src/bool.erl) | 2 | ||||
-rw-r--r-- | gen/src/std@expect.erl (renamed from gen/src/expect.erl) | 2 | ||||
-rw-r--r-- | gen/src/std@float.erl (renamed from gen/src/float.erl) | 4 | ||||
-rw-r--r-- | gen/src/std@http.erl (renamed from gen/src/http.erl) | 2 | ||||
-rw-r--r-- | gen/src/std@int.erl (renamed from gen/src/int.erl) | 2 | ||||
-rw-r--r-- | gen/src/std@iodata.erl (renamed from gen/src/iodata.erl) | 2 | ||||
-rw-r--r-- | gen/src/std@list.erl (renamed from gen/src/list.erl) | 4 | ||||
-rw-r--r-- | gen/src/std@map_dict.erl (renamed from gen/src/map_dict.erl) | 4 | ||||
-rw-r--r-- | gen/src/std@order.erl (renamed from gen/src/order.erl) | 2 | ||||
-rw-r--r-- | gen/src/std@result.erl (renamed from gen/src/result.erl) | 2 | ||||
-rw-r--r-- | gen/src/std@string.erl | 28 | ||||
-rw-r--r-- | gen/src/std@tuple.erl | 28 | ||||
-rw-r--r-- | gen/src/str.erl | 25 | ||||
-rw-r--r-- | gen/src/tuple.erl | 28 |
16 files changed, 76 insertions, 73 deletions
diff --git a/gen/src/any.erl b/gen/src/std@any.erl index 62be0c6..8aec08c 100644 --- a/gen/src/any.erl +++ b/gen/src/std@any.erl @@ -1,10 +1,10 @@ --module(any). +-module(std@any). -compile(no_auto_import). -export([from/1, unsafe_coerce/1, string/1, int/1, float/1, atom/1, bool/1, thunk/1, list/2, tuple/1, field/2]). list_module() -> - list. + std@list. from(A) -> gleam__stdlib:identity(A). @@ -34,10 +34,10 @@ list_any(A) -> gleam__stdlib:decode_list(A). list(Any, Decode) -> - result:then(list_any(Any), - fun(Capture1) -> - (list_module()):traverse(Capture1, Decode) - end). + std@result:then(list_any(Any), + fun(Capture1) -> + (list_module()):traverse(Capture1, Decode) + end). tuple(A) -> gleam__stdlib:decode_tuple(A). diff --git a/gen/src/atom.erl b/gen/src/std@atom.erl index 450245a..a964101 100644 --- a/gen/src/atom.erl +++ b/gen/src/std@atom.erl @@ -1,4 +1,4 @@ --module(atom). +-module(std@atom). -compile(no_auto_import). -export([from_string/1, create_from_string/1, to_string/1]). diff --git a/gen/src/bool.erl b/gen/src/std@bool.erl index 47fba5d..c77a2d8 100644 --- a/gen/src/bool.erl +++ b/gen/src/std@bool.erl @@ -1,4 +1,4 @@ --module(bool). +-module(std@bool). -compile(no_auto_import). -export([negate/1, compare/2, max/2, min/2, to_int/1]). diff --git a/gen/src/expect.erl b/gen/src/std@expect.erl index 602f3fb..30b3156 100644 --- a/gen/src/expect.erl +++ b/gen/src/std@expect.erl @@ -1,4 +1,4 @@ --module(expect). +-module(std@expect). -compile(no_auto_import). -export([equal/2, not_equal/2, true/1, false/1, is_ok/1, is_error/1, fail/0]). diff --git a/gen/src/float.erl b/gen/src/std@float.erl index cd1385c..c627707 100644 --- a/gen/src/float.erl +++ b/gen/src/std@float.erl @@ -1,4 +1,4 @@ --module(float). +-module(std@float). -compile(no_auto_import). -export([parse/1, to_string/1, ceiling/1, floor/1, round/1, truncate/1]). @@ -7,7 +7,7 @@ parse(A) -> gleam__stdlib:parse_float(A). to_string(F) -> - iodata:to_string(iodata:from_float(F)). + std@iodata:to_string(std@iodata:from_float(F)). ceiling(A) -> math:ceil(A). diff --git a/gen/src/http.erl b/gen/src/std@http.erl index 6d2e42a..c141e95 100644 --- a/gen/src/http.erl +++ b/gen/src/std@http.erl @@ -1,4 +1,4 @@ --module(http). +-module(std@http). -compile(no_auto_import). -export([]). diff --git a/gen/src/int.erl b/gen/src/std@int.erl index 21ad7d3..9942040 100644 --- a/gen/src/int.erl +++ b/gen/src/std@int.erl @@ -1,4 +1,4 @@ --module(int). +-module(std@int). -compile(no_auto_import). -export([parse/1, to_string/1, to_base_string/2, compare/2]). diff --git a/gen/src/iodata.erl b/gen/src/std@iodata.erl index 540af1b..e115bbc 100644 --- a/gen/src/iodata.erl +++ b/gen/src/std@iodata.erl @@ -1,4 +1,4 @@ --module(iodata). +-module(std@iodata). -compile(no_auto_import). -export([prepend/2, append/2, prepend_iodata/2, append_iodata/2, from_strings/1, concat/1, new/1, to_string/1, byte_size/1, from_float/1, lowercase/1, uppercase/1, reverse/1, split/2, replace/3, is_equal/2, is_empty/1]). diff --git a/gen/src/list.erl b/gen/src/std@list.erl index 8df10f6..db2efae 100644 --- a/gen/src/list.erl +++ b/gen/src/std@list.erl @@ -1,4 +1,4 @@ --module(list). +-module(std@list). -compile(no_auto_import). -export([length/1, reverse/1, is_empty/1, contains/2, head/1, tail/1, filter/2, map/2, index_map/2, traverse/2, drop/2, take/2, new/0, append/2, flatten/1, fold/3, fold_right/3, find/2, all/2, any/2, zip/2, strict_zip/2, intersperse/2, at/2, unique/1, sort/1, range/2, repeat/2, split/2, split_while/2]). @@ -309,7 +309,7 @@ sort(List) -> end. range(Start, Stop) -> - case int:compare(Start, Stop) of + case std@int:compare(Start, Stop) of eq -> []; diff --git a/gen/src/map_dict.erl b/gen/src/std@map_dict.erl index 5155ec7..b736096 100644 --- a/gen/src/map_dict.erl +++ b/gen/src/std@map_dict.erl @@ -1,4 +1,4 @@ --module(map_dict). +-module(std@map_dict). -compile(no_auto_import). -export([size/1, to_list/1, from_list/1, has_key/2, new/0, fetch/2, put/3, map_values/2, keys/1, values/1, filter/2, take/2, merge/2, delete/2, drop/2, update/3, fold/3]). @@ -64,7 +64,7 @@ delete(Map, Key) -> erl_delete(Key, Map). drop(Map, Keys) -> - list:fold(Keys, Map, fun(Key, Acc) -> delete(Acc, Key) end). + std@list:fold(Keys, Map, fun(Key, Acc) -> delete(Acc, Key) end). update(Dict, Key, F) -> case fetch(Dict, Key) of diff --git a/gen/src/order.erl b/gen/src/std@order.erl index 7921740..3a816d5 100644 --- a/gen/src/order.erl +++ b/gen/src/std@order.erl @@ -1,4 +1,4 @@ --module(order). +-module(std@order). -compile(no_auto_import). -export([reverse/1, to_int/1, compare/2, max/2, min/2]). diff --git a/gen/src/result.erl b/gen/src/std@result.erl index cd66908..eccddfd 100644 --- a/gen/src/result.erl +++ b/gen/src/std@result.erl @@ -1,4 +1,4 @@ --module(result). +-module(std@result). -compile(no_auto_import). -export([is_ok/1, is_error/1, map/2, map_error/2, flatten/1, then/2, unwrap/2]). diff --git a/gen/src/std@string.erl b/gen/src/std@string.erl new file mode 100644 index 0000000..a86cfac --- /dev/null +++ b/gen/src/std@string.erl @@ -0,0 +1,28 @@ +-module(std@string). +-compile(no_auto_import). + +-export([length/1, lowercase/1, uppercase/1, reverse/1, split/2, replace/3, append/2]). + +length(A) -> + string:length(A). + +lowercase(A) -> + string:lowercase(A). + +uppercase(A) -> + string:uppercase(A). + +reverse(String) -> + std@iodata:to_string(std@iodata:reverse(std@iodata:new(String))). + +split(String, On) -> + std@list:map(std@iodata:split(std@iodata:new(String), On), + fun std@iodata:to_string/1). + +replace(String, Pattern, With) -> + std@iodata:to_string(std@iodata:replace(std@iodata:new(String), + Pattern, + With)). + +append(S1, S2) -> + std@iodata:to_string(std@iodata:append(std@iodata:new(S1), S2)). diff --git a/gen/src/std@tuple.erl b/gen/src/std@tuple.erl new file mode 100644 index 0000000..0c9e89d --- /dev/null +++ b/gen/src/std@tuple.erl @@ -0,0 +1,28 @@ +-module(std@tuple). +-compile(no_auto_import). + +-export([new/2, first/1, second/1, swap/1, fetch/2]). + +new(A, B) -> + {A, B}. + +first(Tup) -> + {A, _} = Tup, + A. + +second(Tup) -> + {_, A} = Tup, + A. + +swap(Tup) -> + {A, B} = Tup, + {B, A}. + +fetch(Haystack, Needle) -> + std@list:find(Haystack, fun(Tuple) -> case first(Tuple) =:= Needle of + true -> + {ok, second(Tuple)}; + + false -> + {error, []} + end end). diff --git a/gen/src/str.erl b/gen/src/str.erl deleted file mode 100644 index 153fd49..0000000 --- a/gen/src/str.erl +++ /dev/null @@ -1,25 +0,0 @@ --module(str). --compile(no_auto_import). - --export([length/1, lowercase/1, uppercase/1, reverse/1, split/2, replace/3, append/2]). - -length(A) -> - string:length(A). - -lowercase(A) -> - string:lowercase(A). - -uppercase(A) -> - string:uppercase(A). - -reverse(String) -> - iodata:to_string(iodata:reverse(iodata:new(String))). - -split(String, On) -> - list:map(iodata:split(iodata:new(String), On), fun iodata:to_string/1). - -replace(String, Pattern, With) -> - iodata:to_string(iodata:replace(iodata:new(String), Pattern, With)). - -append(S1, S2) -> - iodata:to_string(iodata:append(iodata:new(S1), S2)). diff --git a/gen/src/tuple.erl b/gen/src/tuple.erl deleted file mode 100644 index fe3ce03..0000000 --- a/gen/src/tuple.erl +++ /dev/null @@ -1,28 +0,0 @@ --module(tuple). --compile(no_auto_import). - --export([new/2, first/1, second/1, swap/1, fetch/2]). - -new(A, B) -> - {A, B}. - -first(Tup) -> - {A, _} = Tup, - A. - -second(Tup) -> - {_, A} = Tup, - A. - -swap(Tup) -> - {A, B} = Tup, - {B, A}. - -fetch(Haystack, Needle) -> - list:find(Haystack, fun(Tuple) -> case first(Tuple) =:= Needle of - true -> - {ok, second(Tuple)}; - - false -> - {error, []} - end end). |