aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2019-02-03 00:08:30 +0000
committerLouis Pilfold <louis@lpil.uk>2019-02-03 00:08:30 +0000
commitfeadf9b0bf553f5195cc82e3303c187a2f0a5c30 (patch)
tree5ebb4da05f57ff381b3cca28794495dce6fa6a2e /src
parent501e5029131d40d6b279df316ab6bb3cd64b936a (diff)
downloadgleam_stdlib-feadf9b0bf553f5195cc82e3303c187a2f0a5c30.tar.gz
gleam_stdlib-feadf9b0bf553f5195cc82e3303c187a2f0a5c30.zip
Update examples to remove atoms
Diffstat (limited to 'src')
-rw-r--r--src/any.gleam6
-rw-r--r--src/expect.gleam8
-rw-r--r--src/iodata.gleam12
-rw-r--r--src/list.gleam4
-rw-r--r--src/map.gleam46
5 files changed, 38 insertions, 38 deletions
diff --git a/src/any.gleam b/src/any.gleam
index 30c6cf4..bb34ac4 100644
--- a/src/any.gleam
+++ b/src/any.gleam
@@ -1,5 +1,5 @@
// doc """
-// `Any` data is data that we don't know the type of yet.
+// `Any` data is data that we don"t know the type of yet.
// We likely get data like this from interop with Erlang, or from
// IO with the outside world.
// """
@@ -8,7 +8,7 @@ pub external type Any;
// doc """
// 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";
// doc """
// Unsafely cast any type into any other type.o
@@ -16,4 +16,4 @@ pub external fn from(a) -> Any = 'gleam__stdlib' 'identity';
// 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 unsafeCoerce(a) -> b = 'gleam__stdlib' 'identity';
+pub external fn unsafeCoerce(a) -> b = "gleam__stdlib" "identity";
diff --git a/src/expect.gleam b/src/expect.gleam
index f36ce08..a597d9a 100644
--- a/src/expect.gleam
+++ b/src/expect.gleam
@@ -3,13 +3,13 @@
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 fn fail() {
true(False)
diff --git a/src/iodata.gleam b/src/iodata.gleam
index 285a99d..f42f86e 100644
--- a/src/iodata.gleam
+++ b/src/iodata.gleam
@@ -5,19 +5,19 @@ import any
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 of(String) -> Iodata =
- 'gleam__stdlib' 'identity';
+ "gleam__stdlib" "identity";
pub external fn from(List(String)) -> Iodata =
- 'gleam__stdlib' 'identity';
+ "gleam__stdlib" "identity";
pub external fn to_string(Iodata) -> String =
- 'erlang' 'iolist_to_binary';
+ "erlang" "iolist_to_binary";
pub external fn byte_size(Iodata) -> Int =
- 'erlang' 'iolist_size';
+ "erlang" "iolist_size";
diff --git a/src/list.gleam b/src/list.gleam
index 9b85260..7d3d023 100644
--- a/src/list.gleam
+++ b/src/list.gleam
@@ -6,7 +6,7 @@ pub enum Error =
// Using the Erlang C BIF implementation.
//
-pub external fn length(List(a)) -> Int = 'erlang' 'length'
+pub external fn length(List(a)) -> Int = "erlang" "length"
test length {
length([]) |> expect:equal(_, 0)
@@ -17,7 +17,7 @@ test length {
// Using the Erlang C BIF implementation.
//
-pub external fn reverse(List(a)) -> List(a) = 'erlang' 'reverse'
+pub external fn reverse(List(a)) -> List(a) = "erlang" "reverse"
test reverse {
length([]) |> expect:equal(_, [])
diff --git a/src/map.gleam b/src/map.gleam
index 032ef90..4f9f2b2 100644
--- a/src/map.gleam
+++ b/src/map.gleam
@@ -5,7 +5,7 @@ import expect
pub external type Map(key, value);
pub external fn new() -> Map(key, value))
- = 'maps' 'new'
+ = "maps" "new"
test new {
new()
@@ -14,7 +14,7 @@ test new {
}
pub external fn size(Map(_, _)) -> Int
- = 'maps' 'size'
+ = "maps" "size"
test size {
[]
@@ -39,7 +39,7 @@ test size {
}
external fn is_key(key, Map(key, _)) -> Bool
- = 'maps' 'is_key'
+ = "maps" "is_key"
pub fn has_key(map, key) {
is_key(key, map)
@@ -87,14 +87,14 @@ test from_record {
|> expect:equal(_, 1)
map
- |> expect:equal(_, from_list([{'name', "Jane"}]))
+ |> expect:equal(_, from_list([{"name", "Jane"}]))
}
pub external fn to_list(Map(key, value)) -> List(Tuple(key, value))
- = 'maps' 'to_list'
+ = "maps" "to_list"
pub external fn from_list(List(Tuple(key, value))) -> Map(key, value)
- = 'maps' 'from_list'
+ = "maps" "from_list"
test from_list {
proplist = [
@@ -113,7 +113,7 @@ test from_list {
}
pub external fn fetch(Map(key, value), key) -> Result(Unit, value)
- = 'gleam__stdlib' 'map_fetch';
+ = "gleam__stdlib" "map_fetch";
test fetch {
proplist = [
@@ -136,7 +136,7 @@ test fetch {
}
external fn erl_put(key, value, Map(key, value)) -> Map(key, value)
- = 'maps' 'put';
+ = "maps" "put";
pub fn put(map, key, value) {
erl_put(key, value, map)
@@ -144,14 +144,14 @@ pub fn put(map, key, value) {
test put {
new()
- |> put(_, 'a', 0)
- |> put(_, 'b', 1)
- |> put(_, 'c', 2)
- |> expect:equal(_, result:Ok(from_list([{'a', 0}, {'b', 1}, {'c', 2}])))
+ |> put(_, "a", 0)
+ |> put(_, "b", 1)
+ |> put(_, "c", 2)
+ |> expect:equal(_, result:Ok(from_list([{"a", 0}, {"b", 1}, {"c", 2}])))
}
external fn erl_map_values(fn(key, value) -> value, Map(key, value)) -> Map(key, value)
- = 'maps' 'map';
+ = "maps" "map";
pub fn map_values(map, fun) {
erl_map_values(fun, map)
@@ -169,27 +169,27 @@ test map_values {
}
pub external fn keys(Map(keys, _)) -> List(keys)
- = 'maps' 'keys'
+ = "maps" "keys"
test keys {
[
- {'a', 0},
- {'b', 1},
- {'c', 2},
+ {"a", 0},
+ {"b", 1},
+ {"c", 2},
]
|> from_list
|> keys
- |> expect:equal(_, ['a', 'b', 'c']))
+ |> expect:equal(_, ["a", "b", "c"]))
}
pub external fn values(Map(_, values)) -> List(values)
- = 'maps' 'values'
+ = "maps" "values"
test values {
[
- {'a', 0},
- {'b', 1},
- {'c', 2},
+ {"a", 0},
+ {"b", 1},
+ {"c", 2},
]
|> from_list
|> values
@@ -197,7 +197,7 @@ test values {
}
external fn erl_filter(fn(key, value) -> Bool, Map(key, value)) -> Map(key, value)
- = 'maps' 'filter';
+ = "maps" "filter";
pub fn filter(map, fun) {
filter(fun, map)