diff options
author | Michael Jones <m.pricejones@gmail.com> | 2021-08-09 17:54:48 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2021-08-09 19:00:22 +0100 |
commit | bdc149e20483bf0769062a270728d7c863ff15b2 (patch) | |
tree | 0019ea26ad7cba1536ea33b0633f633a2c68cf08 | |
parent | 5c76d79495e3dd63dc11470ee2967be9b639f25a (diff) | |
download | gleam_stdlib-bdc149e20483bf0769062a270728d7c863ff15b2.tar.gz gleam_stdlib-bdc149e20483bf0769062a270728d7c863ff15b2.zip |
Various additional fixes
Mostly syntax. Missing braces.
Additionally, I can't see a string_builder.new so I'm not sure what the
'new' is referring to in these doc tests. I've deleted them for the
moment but they should be reinstated.
One function doesn't need to be public.
-rw-r--r-- | src/gleam/iterator.gleam | 8 | ||||
-rw-r--r-- | src/gleam/list.gleam | 14 | ||||
-rw-r--r-- | src/gleam/option.gleam | 2 | ||||
-rw-r--r-- | src/gleam/pair.gleam | 4 | ||||
-rw-r--r-- | src/gleam/queue.gleam | 6 | ||||
-rw-r--r-- | src/gleam/result.gleam | 2 | ||||
-rw-r--r-- | src/gleam/string_builder.gleam | 12 |
7 files changed, 18 insertions, 30 deletions
diff --git a/src/gleam/iterator.gleam b/src/gleam/iterator.gleam index 4f8b7ff..67100e9 100644 --- a/src/gleam/iterator.gleam +++ b/src/gleam/iterator.gleam @@ -405,7 +405,7 @@ pub fn filter( /// /// ## Examples /// -/// > [1, 2] |> from_list |> cycle |> take(6) +/// > [1, 2] |> from_list |> cycle |> take(6) |> to_list /// [1, 2, 1, 2, 1, 2] /// pub fn cycle(iterator: Iterator(a)) -> Iterator(a) { @@ -509,7 +509,7 @@ pub fn index(over iterator: Iterator(element)) -> Iterator(#(Int, element)) { /// /// ## Examples /// -/// > iterate(1, fn(n) { n * 3 }) |> take(5) +/// > iterate(1, fn(n) { n * 3 }) |> take(5) |> to_list /// [1, 3, 9, 27, 81] /// pub fn iterate( @@ -756,10 +756,10 @@ fn do_sized_chunk( /// /// ## Examples /// -/// > from_list([1, 2, 3, 4, 5, 6]) |> chunk(into: 2) |> to_list +/// > from_list([1, 2, 3, 4, 5, 6]) |> sized_chunk(into: 2) |> to_list /// [[1, 2], [3, 4], [5, 6]] /// -/// > from_list([1, 2, 3, 4, 5, 6, 7, 8]) |> chunk(into: 3) |> to_list +/// > from_list([1, 2, 3, 4, 5, 6, 7, 8]) |> sized_chunk(into: 3) |> to_list /// [[1, 2, 3], [4, 5, 6], [7, 8]] /// pub fn sized_chunk( diff --git a/src/gleam/list.gleam b/src/gleam/list.gleam index fdf2caf..9254c7f 100644 --- a/src/gleam/list.gleam +++ b/src/gleam/list.gleam @@ -99,7 +99,7 @@ if erlang { } if javascript { - pub fn do_reverse(list) { + fn do_reverse(list) { do_reverse_acc(list, []) } @@ -1185,10 +1185,10 @@ pub fn pop_map( /// ## Examples /// /// > key_pop([#("a", 0), #("b", 1)], "a") -/// Ok(#(0, [#("b", 1)]) +/// Ok(#(0, [#("b", 1)])) /// /// > key_pop([#("a", 0), #("b", 1)], "b") -/// Ok(#(1, [#("a", 0)]) +/// Ok(#(1, [#("a", 0)])) /// /// > key_pop([#("a", 0), #("b", 1)], "c") /// Error(Nil) @@ -1331,7 +1331,7 @@ pub fn window_by_2(l: List(a)) -> List(#(a, a)) { /// /// ## Examples /// -/// > drop_while([1, 2, 3, 4], fun (x) { x < 3 }) +/// > drop_while([1, 2, 3, 4], fn (x) { x < 3 }) /// [3, 4] /// pub fn drop_while( @@ -1367,7 +1367,7 @@ fn do_take_while( /// /// ## Examples /// -/// > take_while([1, 2, 3, 2, 4], fun (x) { x < 3 }) +/// > take_while([1, 2, 3, 2, 4], fn (x) { x < 3 }) /// [1, 2] /// pub fn take_while( @@ -1446,10 +1446,10 @@ fn do_sized_chunk( /// /// ## Examples /// -/// > [1, 2, 3, 4, 5, 6] |> chunk(into: 2) +/// > [1, 2, 3, 4, 5, 6] |> sized_chunk(into: 2) /// [[1, 2], [3, 4], [5, 6]] /// -/// > [1, 2, 3, 4, 5, 6, 7, 8] |> chunk(into: 3) +/// > [1, 2, 3, 4, 5, 6, 7, 8] |> sized_chunk(into: 3) /// [[1, 2, 3], [4, 5, 6], [7, 8]] /// pub fn sized_chunk(in list: List(a), into count: Int) -> List(List(a)) { diff --git a/src/gleam/option.gleam b/src/gleam/option.gleam index f72f552..640662b 100644 --- a/src/gleam/option.gleam +++ b/src/gleam/option.gleam @@ -88,7 +88,7 @@ pub fn to_result(option: Option(a), e) -> Result(a, e) { /// /// > from_result(Ok(1)) /// Some(1) -/// > from_result(Error"some_error")) +/// > from_result(Error("some_error")) /// None /// pub fn from_result(result: Result(a, e)) -> Option(a) { diff --git a/src/gleam/pair.gleam b/src/gleam/pair.gleam index 6143ee9..0770e92 100644 --- a/src/gleam/pair.gleam +++ b/src/gleam/pair.gleam @@ -40,7 +40,7 @@ pub fn swap(pair: #(a, b)) -> #(b, a) { /// ## Examples /// /// > #(1, 2) |> map_first(fn(n) { n * 2 }) -/// 2 +/// #(2, 2) /// pub fn map_first(of pair: #(a, b), with fun: fn(a) -> c) -> #(c, b) { let #(a, b) = pair @@ -53,7 +53,7 @@ pub fn map_first(of pair: #(a, b), with fun: fn(a) -> c) -> #(c, b) { /// ## Examples /// /// > #(1, 2) |> map_second(fn(n) { n * 2 }) -/// 4 +/// #(1, 4) /// pub fn map_second(of pair: #(a, b), with fun: fn(b) -> c) -> #(a, c) { let #(a, b) = pair diff --git a/src/gleam/queue.gleam b/src/gleam/queue.gleam index 6b12cfb..9d887d8 100644 --- a/src/gleam/queue.gleam +++ b/src/gleam/queue.gleam @@ -188,13 +188,13 @@ pub fn pop_front(from queue: Queue(a)) -> Result(#(a, Queue(a)), Nil) { /// /// ## Examples /// -/// > reverse(from_list([])) +/// > [] |> from_list |> reverse |> to_list /// [] /// -/// > reverse(from_list([1])) +/// > [1] |> from_list |> reverse |> to_list /// [1] /// -/// > reverse(from_list([1, 2])) +/// > [1, 2] |> from_list |> reverse |> to_list /// [2, 1] /// pub fn reverse(queue: Queue(a)) -> Queue(a) { diff --git a/src/gleam/result.gleam b/src/gleam/result.gleam index 01c5510..574d71f 100644 --- a/src/gleam/result.gleam +++ b/src/gleam/result.gleam @@ -89,7 +89,7 @@ pub fn map_error( /// > flatten(Ok(Ok(1))) /// Ok(1) /// -/// > flatten(Ok(Error("")) +/// > flatten(Ok(Error(""))) /// Error("") /// /// > flatten(Error(Nil)) diff --git a/src/gleam/string_builder.gleam b/src/gleam/string_builder.gleam index 0a90737..004903d 100644 --- a/src/gleam/string_builder.gleam +++ b/src/gleam/string_builder.gleam @@ -288,12 +288,6 @@ if javascript { /// /// ## Examples /// -/// > from_strings(["a", "b"]) == new("ab") -/// False -/// -/// > is_equal(from_strings(["a", "b"]), new("ab")) -/// True -/// /// pub fn is_equal(a: StringBuilder, b: StringBuilder) -> Bool { do_is_equal(a, b) @@ -313,12 +307,6 @@ if javascript { /// /// ## Examples /// -/// > new("ok") |> is_empty -/// False -/// -/// > new("") |> is_empty -/// True -/// /// > from_strings([]) |> is_empty /// True /// |