diff options
author | Louis Pilfold <louis@lpil.uk> | 2019-09-17 21:04:30 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-09-17 22:20:26 +0100 |
commit | 4dc0d1854fa7dfc0229e27b6b69848564185e43b (patch) | |
tree | 830ff699eb31d61e870d83bbe5ae63752b2c0625 | |
parent | 7ef601e5f01d3f63d93a88675754bd745267d71a (diff) | |
download | gleam_stdlib-4dc0d1854fa7dfc0229e27b6b69848564185e43b.tar.gz gleam_stdlib-4dc0d1854fa7dfc0229e27b6b69848564185e43b.zip |
Rename stdlib native module
-rw-r--r-- | gen/src/gleam@any.erl | 22 | ||||
-rw-r--r-- | gen/src/gleam@atom.erl | 6 | ||||
-rw-r--r-- | gen/src/gleam@expect.erl | 12 | ||||
-rw-r--r-- | gen/src/gleam@float.erl | 2 | ||||
-rw-r--r-- | gen/src/gleam@int.erl | 2 | ||||
-rw-r--r-- | gen/src/gleam@iodata.erl | 14 | ||||
-rw-r--r-- | gen/src/gleam@list.erl | 10 | ||||
-rw-r--r-- | gen/src/gleam@map.erl | 2 | ||||
-rw-r--r-- | src/gleam/any.gleam | 24 | ||||
-rw-r--r-- | src/gleam/atom.gleam | 6 | ||||
-rw-r--r-- | src/gleam/expect.gleam | 12 | ||||
-rw-r--r-- | src/gleam/float.gleam | 2 | ||||
-rw-r--r-- | src/gleam/int.gleam | 2 | ||||
-rw-r--r-- | src/gleam/iodata.gleam | 14 | ||||
-rw-r--r-- | src/gleam/map.gleam | 2 | ||||
-rw-r--r-- | src/gleam/string.gleam | 3 | ||||
-rw-r--r-- | src/gleam_stdlib.erl (renamed from src/gleam__stdlib.erl) | 2 |
17 files changed, 67 insertions, 70 deletions
diff --git a/gen/src/gleam@any.erl b/gen/src/gleam@any.erl index 4b2d17d..b55ce9f 100644 --- a/gen/src/gleam@any.erl +++ b/gen/src/gleam@any.erl @@ -4,31 +4,31 @@ -export([from/1, unsafe_coerce/1, string/1, int/1, float/1, atom/1, bool/1, thunk/1, list/2, pair/1, field/2]). from(A) -> - gleam__stdlib:identity(A). + gleam_stdlib:identity(A). unsafe_coerce(A) -> - gleam__stdlib:identity(A). + gleam_stdlib:identity(A). string(A) -> - gleam__stdlib:decode_string(A). + gleam_stdlib:decode_string(A). int(A) -> - gleam__stdlib:decode_int(A). + gleam_stdlib:decode_int(A). float(A) -> - gleam__stdlib:decode_float(A). + gleam_stdlib:decode_float(A). atom(A) -> - gleam__stdlib:decode_atom(A). + gleam_stdlib:decode_atom(A). bool(A) -> - gleam__stdlib:decode_bool(A). + gleam_stdlib:decode_bool(A). thunk(A) -> - gleam__stdlib:decode_thunk(A). + gleam_stdlib:decode_thunk(A). list_any(A) -> - gleam__stdlib:decode_list(A). + gleam_stdlib:decode_list(A). list(Any, Decode) -> gleam@result:then( @@ -37,7 +37,7 @@ list(Any, Decode) -> ). pair(A) -> - gleam__stdlib:decode_pair(A). + gleam_stdlib:decode_pair(A). field(A, B) -> - gleam__stdlib:decode_field(A, B). + gleam_stdlib:decode_field(A, B). diff --git a/gen/src/gleam@atom.erl b/gen/src/gleam@atom.erl index 83392aa..1150544 100644 --- a/gen/src/gleam@atom.erl +++ b/gen/src/gleam@atom.erl @@ -4,10 +4,10 @@ -export([from_string/1, create_from_string/1, to_string/1]). from_string(A) -> - gleam__stdlib:atom_from_string(A). + gleam_stdlib:atom_from_string(A). create_from_string(A) -> - gleam__stdlib:atom_create_from_string(A). + gleam_stdlib:atom_create_from_string(A). to_string(A) -> - gleam__stdlib:atom_to_string(A). + gleam_stdlib:atom_to_string(A). diff --git a/gen/src/gleam@expect.erl b/gen/src/gleam@expect.erl index 72a4389..eb1c3d4 100644 --- a/gen/src/gleam@expect.erl +++ b/gen/src/gleam@expect.erl @@ -4,22 +4,22 @@ -export([equal/2, not_equal/2, true/1, false/1, is_ok/1, is_error/1, fail/0]). equal(A, B) -> - gleam__stdlib:expect_equal(A, B). + gleam_stdlib:expect_equal(A, B). not_equal(A, B) -> - gleam__stdlib:expect_not_equal(A, B). + gleam_stdlib:expect_not_equal(A, B). true(A) -> - gleam__stdlib:expect_true(A). + gleam_stdlib:expect_true(A). false(A) -> - gleam__stdlib:expect_false(A). + gleam_stdlib:expect_false(A). is_ok(A) -> - gleam__stdlib:expect_is_ok(A). + gleam_stdlib:expect_is_ok(A). is_error(A) -> - gleam__stdlib:expect_is_error(A). + gleam_stdlib:expect_is_error(A). fail() -> true(false). diff --git a/gen/src/gleam@float.erl b/gen/src/gleam@float.erl index 1d19fc7..6aab56b 100644 --- a/gen/src/gleam@float.erl +++ b/gen/src/gleam@float.erl @@ -4,7 +4,7 @@ -export([parse/1, to_string/1, compare/2, ceiling/1, floor/1, round/1, truncate/1]). parse(A) -> - gleam__stdlib:parse_float(A). + gleam_stdlib:parse_float(A). to_string(F) -> gleam@iodata:to_string(gleam@iodata:from_float(F)). diff --git a/gen/src/gleam@int.erl b/gen/src/gleam@int.erl index 49641a6..ea97785 100644 --- a/gen/src/gleam@int.erl +++ b/gen/src/gleam@int.erl @@ -4,7 +4,7 @@ -export([parse/1, to_string/1, to_base_string/2, compare/2]). parse(A) -> - gleam__stdlib:parse_int(A). + gleam_stdlib:parse_int(A). to_string(A) -> erlang:integer_to_binary(A). diff --git a/gen/src/gleam@iodata.erl b/gen/src/gleam@iodata.erl index cf7942e..b70ad78 100644 --- a/gen/src/gleam@iodata.erl +++ b/gen/src/gleam@iodata.erl @@ -4,25 +4,25 @@ -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]). prepend(A, B) -> - gleam__stdlib:iodata_prepend(A, B). + gleam_stdlib:iodata_prepend(A, B). append(A, B) -> - gleam__stdlib:iodata_append(A, B). + gleam_stdlib:iodata_append(A, B). prepend_iodata(A, B) -> - gleam__stdlib:iodata_prepend(A, B). + gleam_stdlib:iodata_prepend(A, B). append_iodata(A, B) -> - gleam__stdlib:iodata_append(A, B). + gleam_stdlib:iodata_append(A, B). from_strings(A) -> - gleam__stdlib:identity(A). + gleam_stdlib:identity(A). concat(A) -> - gleam__stdlib:identity(A). + gleam_stdlib:identity(A). new(A) -> - gleam__stdlib:identity(A). + gleam_stdlib:identity(A). to_string(A) -> erlang:iolist_to_binary(A). diff --git a/gen/src/gleam@list.erl b/gen/src/gleam@list.erl index 324395f..f5b8f6d 100644 --- a/gen/src/gleam@list.erl +++ b/gen/src/gleam@list.erl @@ -24,7 +24,7 @@ contains(List, Elem) -> head(List) -> case List of [] -> - {error, {}}; + {error, nil}; [X | _] -> {ok, X} @@ -33,7 +33,7 @@ head(List) -> tail(List) -> case List of [] -> - {error, {}}; + {error, nil}; [_ | Xs] -> {ok, Xs} @@ -172,7 +172,7 @@ fold_right(List, Acc, Fun) -> find(Haystack, F) -> case Haystack of [] -> - {error, {}}; + {error, nil}; [X | Rest] -> case F(X) of @@ -250,12 +250,12 @@ intersperse(List, Elem) -> at(List, I) -> case I < 0 of true -> - {error, {}}; + {error, nil}; false -> case List of [] -> - {error, {}}; + {error, nil}; [X | Rest] -> case I =:= 0 of diff --git a/gen/src/gleam@map.erl b/gen/src/gleam@map.erl index b93f8bd..96d8b83 100644 --- a/gen/src/gleam@map.erl +++ b/gen/src/gleam@map.erl @@ -22,7 +22,7 @@ new() -> maps:new(). fetch(A, B) -> - gleam__stdlib:map_fetch(A, B). + gleam_stdlib:map_fetch(A, B). erl_put(A, B, C) -> maps:put(A, B, C). diff --git a/src/gleam/any.gleam b/src/gleam/any.gleam index 902fb5c..a8358ac 100644 --- a/src/gleam/any.gleam +++ b/src/gleam/any.gleam @@ -11,35 +11,35 @@ pub external type Any; // Convert any Gleam data into `Any` data. // -pub external fn from(a) -> Any = "gleam__stdlib" "identity"; +pub external fn from(a) -> Any = "gleam_stdlib" "identity"; // Unsafely cast any type into any other type. // // This is an escape hatch for the type system that may be useful when wrapping // native Erlang APIs. It is to be used as a last measure only. // -pub external fn unsafe_coerce(a) -> b = "gleam__stdlib" "identity"; +pub external fn unsafe_coerce(a) -> b = "gleam_stdlib" "identity"; pub external fn string(Any) -> Result(String, String) - = "gleam__stdlib" "decode_string" + = "gleam_stdlib" "decode_string" pub external fn int(Any) -> Result(Int, String) - = "gleam__stdlib" "decode_int" + = "gleam_stdlib" "decode_int" pub external fn float(Any) -> Result(Float, String) - = "gleam__stdlib" "decode_float" + = "gleam_stdlib" "decode_float" pub external fn atom(Any) -> Result(atom.Atom, String) - = "gleam__stdlib" "decode_atom" + = "gleam_stdlib" "decode_atom" pub external fn bool(Any) -> Result(Bool, String) - = "gleam__stdlib" "decode_bool" + = "gleam_stdlib" "decode_bool" pub external fn thunk(Any) -> Result(fn() -> Any, String) - = "gleam__stdlib" "decode_thunk" + = "gleam_stdlib" "decode_thunk" -external fn list_any(Any) -> Result(List(Any), String) = - "gleam__stdlib" "decode_list" +external fn list_any(Any) -> Result(List(Any), String) + = "gleam_stdlib" "decode_list" pub fn list(any, decode) { any @@ -48,7 +48,7 @@ pub fn list(any, decode) { } pub external fn pair(Any) -> Result(pair.Pair(Any, Any), String) - = "gleam__stdlib" "decode_pair" + = "gleam_stdlib" "decode_pair" pub external fn field(Any, a) -> Result(Any, String) - = "gleam__stdlib" "decode_field" + = "gleam_stdlib" "decode_field" diff --git a/src/gleam/atom.gleam b/src/gleam/atom.gleam index 67d040d..24b82d5 100644 --- a/src/gleam/atom.gleam +++ b/src/gleam/atom.gleam @@ -4,14 +4,14 @@ pub enum AtomNotLoaded = | AtomNotLoaded pub external fn from_string(String) -> Result(Atom, AtomNotLoaded) = - "gleam__stdlib" "atom_from_string"; + "gleam_stdlib" "atom_from_string"; // This function can create a new atom if one does not already exist for // the given string. Atoms are not garbage collected so this can result // in a memory leak if called over time on new values // pub external fn create_from_string(String) -> Atom = - "gleam__stdlib" "atom_create_from_string"; + "gleam_stdlib" "atom_create_from_string"; pub external fn to_string(Atom) -> String = - "gleam__stdlib" "atom_to_string"; + "gleam_stdlib" "atom_to_string"; diff --git a/src/gleam/expect.gleam b/src/gleam/expect.gleam index 5ea6a93..a42a02e 100644 --- a/src/gleam/expect.gleam +++ b/src/gleam/expect.gleam @@ -3,17 +3,17 @@ pub external type Expectation; -pub external fn equal(a, a) -> Expectation = "gleam__stdlib" "expect_equal"; +pub external fn equal(a, a) -> Expectation = "gleam_stdlib" "expect_equal"; -pub external fn not_equal(a, a) -> Expectation = "gleam__stdlib" "expect_not_equal"; +pub external fn not_equal(a, a) -> Expectation = "gleam_stdlib" "expect_not_equal"; -pub external fn true(Bool) -> Expectation = "gleam__stdlib" "expect_true"; +pub external fn true(Bool) -> Expectation = "gleam_stdlib" "expect_true"; -pub external fn false(Bool) -> Expectation = "gleam__stdlib" "expect_false"; +pub external fn false(Bool) -> Expectation = "gleam_stdlib" "expect_false"; -pub external fn is_ok(Result(a, b)) -> Expectation = "gleam__stdlib" "expect_is_ok"; +pub external fn is_ok(Result(a, b)) -> Expectation = "gleam_stdlib" "expect_is_ok"; -pub external fn is_error(Result(a, b)) -> Expectation = "gleam__stdlib" "expect_is_error"; +pub external fn is_error(Result(a, b)) -> Expectation = "gleam_stdlib" "expect_is_error"; pub fn fail() { true(False) diff --git a/src/gleam/float.gleam b/src/gleam/float.gleam index 4b6d589..9095ec4 100644 --- a/src/gleam/float.gleam +++ b/src/gleam/float.gleam @@ -5,7 +5,7 @@ pub enum NotAFloat = | NotAFloat pub external fn parse(String) -> Result(Float, NotAFloat) = - "gleam__stdlib" "parse_float"; + "gleam_stdlib" "parse_float"; pub fn to_string(f) { f diff --git a/src/gleam/int.gleam b/src/gleam/int.gleam index 7a83fba..10731a3 100644 --- a/src/gleam/int.gleam +++ b/src/gleam/int.gleam @@ -1,6 +1,6 @@ import gleam/order -pub external fn parse(String) -> Result(Int, Nil) = "gleam__stdlib" "parse_int"; +pub external fn parse(String) -> Result(Int, Nil) = "gleam_stdlib" "parse_int"; pub external fn to_string(Int) -> String = "erlang" "integer_to_binary" diff --git a/src/gleam/iodata.gleam b/src/gleam/iodata.gleam index 56efc65..e1b017e 100644 --- a/src/gleam/iodata.gleam +++ b/src/gleam/iodata.gleam @@ -1,25 +1,25 @@ pub external type Iodata; pub external fn prepend(Iodata, String) -> Iodata = - "gleam__stdlib" "iodata_prepend"; + "gleam_stdlib" "iodata_prepend"; pub external fn append(Iodata, String) -> Iodata = - "gleam__stdlib" "iodata_append"; + "gleam_stdlib" "iodata_append"; pub external fn prepend_iodata(Iodata, Iodata) -> Iodata = - "gleam__stdlib" "iodata_prepend"; + "gleam_stdlib" "iodata_prepend"; pub external fn append_iodata(Iodata, Iodata) -> Iodata = - "gleam__stdlib" "iodata_append"; + "gleam_stdlib" "iodata_append"; pub external fn from_strings(List(String)) -> Iodata = - "gleam__stdlib" "identity"; + "gleam_stdlib" "identity"; pub external fn concat(List(Iodata)) -> Iodata = - "gleam__stdlib" "identity"; + "gleam_stdlib" "identity"; pub external fn new(String) -> Iodata = - "gleam__stdlib" "identity"; + "gleam_stdlib" "identity"; pub external fn to_string(Iodata) -> String = "erlang" "iolist_to_binary"; diff --git a/src/gleam/map.gleam b/src/gleam/map.gleam index b46590d..af49d5e 100644 --- a/src/gleam/map.gleam +++ b/src/gleam/map.gleam @@ -25,7 +25,7 @@ pub external fn new() -> MapDict(key, value) = "maps" "new" pub external fn fetch(MapDict(key, value), key) -> Result(value, Nil) - = "gleam__stdlib" "map_fetch"; + = "gleam_stdlib" "map_fetch"; external fn erl_put(key, value, MapDict(key, value)) -> MapDict(key, value) = "maps" "put"; diff --git a/src/gleam/string.gleam b/src/gleam/string.gleam index 10de2b7..9714220 100644 --- a/src/gleam/string.gleam +++ b/src/gleam/string.gleam @@ -3,9 +3,6 @@ import gleam/list pub external fn length(String) -> Int = "string" "length" -pub enum ParseError = - | ParseError - pub external fn lowercase(String) -> String = "string" "lowercase" pub external fn uppercase(String) -> String = "string" "uppercase" diff --git a/src/gleam__stdlib.erl b/src/gleam_stdlib.erl index b9236ed..480518a 100644 --- a/src/gleam__stdlib.erl +++ b/src/gleam_stdlib.erl @@ -1,4 +1,4 @@ --module(gleam__stdlib). +-module(gleam_stdlib). -include_lib("eunit/include/eunit.hrl"). -export([expect_equal/2, expect_not_equal/2, expect_true/1, expect_false/1, |