diff options
author | Louis Pilfold <louis@lpil.uk> | 2019-06-25 22:48:07 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-06-25 22:48:07 +0100 |
commit | 2c2541750ca4b7b604070c75c18d84be833c97d5 (patch) | |
tree | f5e63d941a1c7e2c2d4dff1d81c43fa2766308ae /gen/src | |
parent | 96c20b8ebf8420fbba75c97fa08eaeb34e8dc394 (diff) | |
download | gleam_stdlib-2c2541750ca4b7b604070c75c18d84be833c97d5.tar.gz gleam_stdlib-2c2541750ca4b7b604070c75c18d84be833c97d5.zip |
stdlib namespace std -> gleam
Diffstat (limited to 'gen/src')
-rw-r--r-- | gen/src/gleam@any.erl (renamed from gen/src/std@any.erl) | 8 | ||||
-rw-r--r-- | gen/src/gleam@atom.erl (renamed from gen/src/std@atom.erl) | 2 | ||||
-rw-r--r-- | gen/src/gleam@bool.erl (renamed from gen/src/std@bool.erl) | 2 | ||||
-rw-r--r-- | gen/src/gleam@expect.erl (renamed from gen/src/std@expect.erl) | 2 | ||||
-rw-r--r-- | gen/src/gleam@float.erl (renamed from gen/src/std@float.erl) | 4 | ||||
-rw-r--r-- | gen/src/gleam@http.erl (renamed from gen/src/std@http.erl) | 2 | ||||
-rw-r--r-- | gen/src/gleam@int.erl (renamed from gen/src/std@int.erl) | 2 | ||||
-rw-r--r-- | gen/src/gleam@iodata.erl (renamed from gen/src/std@iodata.erl) | 2 | ||||
-rw-r--r-- | gen/src/gleam@list.erl (renamed from gen/src/std@list.erl) | 4 | ||||
-rw-r--r-- | gen/src/gleam@map_dict.erl (renamed from gen/src/std@map_dict.erl) | 4 | ||||
-rw-r--r-- | gen/src/gleam@order.erl (renamed from gen/src/std@order.erl) | 2 | ||||
-rw-r--r-- | gen/src/gleam@result.erl (renamed from gen/src/std@result.erl) | 2 | ||||
-rw-r--r-- | gen/src/gleam@string.erl | 28 | ||||
-rw-r--r-- | gen/src/gleam@tuple.erl | 28 | ||||
-rw-r--r-- | gen/src/std@string.erl | 28 | ||||
-rw-r--r-- | gen/src/std@tuple.erl | 28 |
16 files changed, 75 insertions, 73 deletions
diff --git a/gen/src/std@any.erl b/gen/src/gleam@any.erl index 5a1a844..a81a836 100644 --- a/gen/src/std@any.erl +++ b/gen/src/gleam@any.erl @@ -1,4 +1,4 @@ --module(std@any). +-module(gleam@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]). @@ -31,8 +31,10 @@ list_any(A) -> gleam__stdlib:decode_list(A). list(Any, Decode) -> - std@result:then(list_any(Any), - fun(Capture1) -> std@list:traverse(Capture1, Decode) end). + gleam@result:then(list_any(Any), + fun(Capture1) -> + gleam@list:traverse(Capture1, Decode) + end). tuple(A) -> gleam__stdlib:decode_tuple(A). diff --git a/gen/src/std@atom.erl b/gen/src/gleam@atom.erl index a964101..83392aa 100644 --- a/gen/src/std@atom.erl +++ b/gen/src/gleam@atom.erl @@ -1,4 +1,4 @@ --module(std@atom). +-module(gleam@atom). -compile(no_auto_import). -export([from_string/1, create_from_string/1, to_string/1]). diff --git a/gen/src/std@bool.erl b/gen/src/gleam@bool.erl index c77a2d8..6714261 100644 --- a/gen/src/std@bool.erl +++ b/gen/src/gleam@bool.erl @@ -1,4 +1,4 @@ --module(std@bool). +-module(gleam@bool). -compile(no_auto_import). -export([negate/1, compare/2, max/2, min/2, to_int/1]). diff --git a/gen/src/std@expect.erl b/gen/src/gleam@expect.erl index 30b3156..72a4389 100644 --- a/gen/src/std@expect.erl +++ b/gen/src/gleam@expect.erl @@ -1,4 +1,4 @@ --module(std@expect). +-module(gleam@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/std@float.erl b/gen/src/gleam@float.erl index c627707..0d8ec08 100644 --- a/gen/src/std@float.erl +++ b/gen/src/gleam@float.erl @@ -1,4 +1,4 @@ --module(std@float). +-module(gleam@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) -> - std@iodata:to_string(std@iodata:from_float(F)). + gleam@iodata:to_string(gleam@iodata:from_float(F)). ceiling(A) -> math:ceil(A). diff --git a/gen/src/std@http.erl b/gen/src/gleam@http.erl index c141e95..8863ae6 100644 --- a/gen/src/std@http.erl +++ b/gen/src/gleam@http.erl @@ -1,4 +1,4 @@ --module(std@http). +-module(gleam@http). -compile(no_auto_import). -export([]). diff --git a/gen/src/std@int.erl b/gen/src/gleam@int.erl index 9942040..49641a6 100644 --- a/gen/src/std@int.erl +++ b/gen/src/gleam@int.erl @@ -1,4 +1,4 @@ --module(std@int). +-module(gleam@int). -compile(no_auto_import). -export([parse/1, to_string/1, to_base_string/2, compare/2]). diff --git a/gen/src/std@iodata.erl b/gen/src/gleam@iodata.erl index e115bbc..cf7942e 100644 --- a/gen/src/std@iodata.erl +++ b/gen/src/gleam@iodata.erl @@ -1,4 +1,4 @@ --module(std@iodata). +-module(gleam@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/std@list.erl b/gen/src/gleam@list.erl index db2efae..548e983 100644 --- a/gen/src/std@list.erl +++ b/gen/src/gleam@list.erl @@ -1,4 +1,4 @@ --module(std@list). +-module(gleam@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 std@int:compare(Start, Stop) of + case gleam@int:compare(Start, Stop) of eq -> []; diff --git a/gen/src/std@map_dict.erl b/gen/src/gleam@map_dict.erl index b736096..77eaf79 100644 --- a/gen/src/std@map_dict.erl +++ b/gen/src/gleam@map_dict.erl @@ -1,4 +1,4 @@ --module(std@map_dict). +-module(gleam@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) -> - std@list:fold(Keys, Map, fun(Key, Acc) -> delete(Acc, Key) end). + gleam@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/std@order.erl b/gen/src/gleam@order.erl index 3a816d5..9e259ed 100644 --- a/gen/src/std@order.erl +++ b/gen/src/gleam@order.erl @@ -1,4 +1,4 @@ --module(std@order). +-module(gleam@order). -compile(no_auto_import). -export([reverse/1, to_int/1, compare/2, max/2, min/2]). diff --git a/gen/src/std@result.erl b/gen/src/gleam@result.erl index eccddfd..77c5a57 100644 --- a/gen/src/std@result.erl +++ b/gen/src/gleam@result.erl @@ -1,4 +1,4 @@ --module(std@result). +-module(gleam@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/gleam@string.erl b/gen/src/gleam@string.erl new file mode 100644 index 0000000..144d866 --- /dev/null +++ b/gen/src/gleam@string.erl @@ -0,0 +1,28 @@ +-module(gleam@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) -> + gleam@iodata:to_string(gleam@iodata:reverse(gleam@iodata:new(String))). + +split(String, On) -> + gleam@list:map(gleam@iodata:split(gleam@iodata:new(String), On), + fun gleam@iodata:to_string/1). + +replace(String, Pattern, With) -> + gleam@iodata:to_string(gleam@iodata:replace(gleam@iodata:new(String), + Pattern, + With)). + +append(S1, S2) -> + gleam@iodata:to_string(gleam@iodata:append(gleam@iodata:new(S1), S2)). diff --git a/gen/src/gleam@tuple.erl b/gen/src/gleam@tuple.erl new file mode 100644 index 0000000..1e236bf --- /dev/null +++ b/gen/src/gleam@tuple.erl @@ -0,0 +1,28 @@ +-module(gleam@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) -> + gleam@list:find(Haystack, fun(Tuple) -> case first(Tuple) =:= Needle of + true -> + {ok, second(Tuple)}; + + false -> + {error, []} + end end). diff --git a/gen/src/std@string.erl b/gen/src/std@string.erl deleted file mode 100644 index a86cfac..0000000 --- a/gen/src/std@string.erl +++ /dev/null @@ -1,28 +0,0 @@ --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 deleted file mode 100644 index 0c9e89d..0000000 --- a/gen/src/std@tuple.erl +++ /dev/null @@ -1,28 +0,0 @@ --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). |