Skip to content

Commit 921fee3

Browse files
janpieperlpil
authored andcommitted
Use consistent phrasing in function docs
1 parent fb54aac commit 921fee3

19 files changed

+199
-199
lines changed

src/gleam/atom.gleam

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub type FromStringError {
2121
AtomNotLoaded
2222
}
2323

24-
/// Find an existing Atom for the given String.
24+
/// Finds an existing Atom for the given String.
2525
///
2626
/// If no atom is found in the virtual machine's atom table for the String then
2727
/// an error is returned.
@@ -37,7 +37,7 @@ pub type FromStringError {
3737
pub external fn from_string(String) -> Result(Atom, FromStringError) =
3838
"gleam_stdlib" "atom_from_string"
3939

40-
/// Create an atom from a string, inserting a new value into the virtual
40+
/// Creates an atom from a string, inserting a new value into the virtual
4141
/// machine's atom table if an atom does not already exist for the given
4242
/// string.
4343
///

src/gleam/bit_builder.gleam

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ import gleam/string_builder.{StringBuilder}
1515
///
1616
pub external type BitBuilder
1717

18-
/// Prepend a bit string to the start of a builder.
18+
/// Prepends a bit string to the start of a builder.
1919
///
2020
/// Runs in constant time.
2121
///
2222
pub external fn prepend(to: BitBuilder, prefix: BitString) -> BitBuilder =
2323
"gleam_stdlib" "iodata_prepend"
2424

25-
/// Append a bit string to the end of a builder.
25+
/// Appends a bit string to the end of a builder.
2626
///
2727
/// Runs in constant time.
2828
///
2929
pub external fn append(to: BitBuilder, suffix: BitString) -> BitBuilder =
3030
"gleam_stdlib" "iodata_append"
3131

32-
/// Prepend a builder onto the start of another.
32+
/// Prepends a builder onto the start of another.
3333
///
3434
/// Runs in constant time.
3535
///
@@ -39,21 +39,21 @@ pub external fn prepend_builder(
3939
) -> BitBuilder =
4040
"gleam_stdlib" "iodata_prepend"
4141

42-
/// Append a builder onto the end of another.
42+
/// Appends a builder onto the end of another.
4343
///
4444
/// Runs in constant time.
4545
///
4646
pub external fn append_builder(to: BitBuilder, suffix: BitBuilder) -> BitBuilder =
4747
"gleam_stdlib" "iodata_append"
4848

49-
/// Prepend a string onto the start of a builder.
49+
/// Prepends a string onto the start of a builder.
5050
///
5151
/// Runs in constant time.
5252
///
5353
pub external fn prepend_string(to: BitBuilder, prefix: String) -> BitBuilder =
5454
"gleam_stdlib" "iodata_prepend"
5555

56-
/// Append a string onto the end of a builder.
56+
/// Appends a string onto the end of a builder.
5757
///
5858
/// Runs in constant time.
5959
///
@@ -67,21 +67,21 @@ pub external fn append_string(to: BitBuilder, suffix: String) -> BitBuilder =
6767
pub external fn concat(List(BitBuilder)) -> BitBuilder =
6868
"gleam_stdlib" "identity"
6969

70-
/// Create a new builder from a string.
70+
/// Creates a new builder from a string.
7171
///
7272
/// Runs in constant time.
7373
///
7474
pub external fn from_string(String) -> BitBuilder =
7575
"gleam_stdlib" "wrap_list"
7676

77-
/// Create a new builder from a string builder.
77+
/// Creates a new builder from a string builder.
7878
///
7979
/// Runs in constant time.
8080
///
8181
pub external fn from_string_builder(StringBuilder) -> BitBuilder =
8282
"gleam_stdlib" "identity"
8383

84-
/// Create a new builder from a bit string.
84+
/// Creates a new builder from a bit string.
8585
///
8686
/// Runs in constant time.
8787
///

src/gleam/bit_string.gleam

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
pub type BitString =
66
BitString
77

8-
/// Convert a UTF-8 String type into a raw BitString type.
8+
/// Converts a UTF-8 String type into a raw BitString type.
99
///
1010
pub external fn from_string(String) -> BitString =
1111
"gleam_stdlib" "identity"
@@ -15,7 +15,7 @@ pub external fn from_string(String) -> BitString =
1515
pub external fn byte_size(BitString) -> Int =
1616
"erlang" "byte_size"
1717

18-
/// Create a new bit string by joining two binaries.
18+
/// Creates a new bit string by joining two binaries.
1919
///
2020
/// ## Examples
2121
///
@@ -38,22 +38,22 @@ pub external fn part(
3838
) -> Result(BitString, Nil) =
3939
"gleam_stdlib" "bit_string_part_"
4040

41-
/// Convert an integer to unsigned 32 bits.
41+
/// Converts an integer to unsigned 32 bits.
4242
///
4343
/// Returns an error if integer is less than zero or equal to or larger than
4444
/// 2^32.
4545
///
4646
pub external fn int_to_u32(Int) -> Result(BitString, Nil) =
4747
"gleam_stdlib" "bit_string_int_to_u32"
4848

49-
/// Convert unsigned 32 bits to an integer.
49+
/// Converts unsigned 32 bits to an integer.
5050
///
5151
/// Returns an error if the bit string is not 32 bits in length.
5252
///
5353
pub external fn int_from_u32(BitString) -> Result(Int, Nil) =
5454
"gleam_stdlib" "bit_string_int_from_u32"
5555

56-
/// Test to see whether a bit string is valid UTF-8.
56+
/// Tests to see whether a bit string is valid UTF-8.
5757
///
5858
pub fn is_utf8(bits: BitString) -> Bool {
5959
case bits {
@@ -66,7 +66,7 @@ pub fn is_utf8(bits: BitString) -> Bool {
6666
external fn unsafe_to_string(BitString) -> String =
6767
"gleam_stdlib" "identity"
6868

69-
/// Convert a bit string to a string.
69+
/// Converts a bit string to a string.
7070
///
7171
/// Returns an error if the bit string is invalid UTF-8 data.
7272
///

src/gleam/dynamic.gleam

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ pub external type Dynamic
1414
pub type Decoder(t) =
1515
fn(Dynamic) -> Result(t, String)
1616

17-
/// Convert any Gleam data into `Dynamic` data.
17+
/// Converts any Gleam data into `Dynamic` data.
1818
///
1919
pub external fn from(a) -> Dynamic =
2020
"gleam_stdlib" "identity"
2121

22-
/// Unsafely cast a Dynamic value into any other type.
22+
/// Unsafely casts a Dynamic value into any other type.
2323
///
2424
/// This is an escape hatch for the type system that may be useful when wrapping
2525
/// native Erlang APIs. It is to be used as a last measure only!
@@ -29,7 +29,7 @@ pub external fn from(a) -> Dynamic =
2929
pub external fn unsafe_coerce(Dynamic) -> a =
3030
"gleam_stdlib" "identity"
3131

32-
/// Check to see whether a Dynamic value is a bit_string, and return the bit_string if
32+
/// Checks to see whether a Dynamic value is a bit_string, and return the bit_string if
3333
/// it is.
3434
///
3535
/// ## Examples
@@ -43,7 +43,7 @@ pub external fn unsafe_coerce(Dynamic) -> a =
4343
pub external fn bit_string(from: Dynamic) -> Result(BitString, String) =
4444
"gleam_stdlib" "decode_bit_string"
4545

46-
/// Check to see whether a Dynamic value is a string, and return the string if
46+
/// Checks to see whether a Dynamic value is a string, and return the string if
4747
/// it is.
4848
///
4949
/// ## Examples
@@ -64,7 +64,7 @@ pub fn string(from: Dynamic) -> Result(String, String) {
6464
})
6565
}
6666

67-
/// Check to see whether a Dynamic value is an int, and return the int if it
67+
/// Checks to see whether a Dynamic value is an int, and return the int if it
6868
/// is.
6969
///
7070
/// ## Examples
@@ -78,7 +78,7 @@ pub fn string(from: Dynamic) -> Result(String, String) {
7878
pub external fn int(from: Dynamic) -> Result(Int, String) =
7979
"gleam_stdlib" "decode_int"
8080

81-
/// Check to see whether a Dynamic value is an float, and return the float if
81+
/// Checks to see whether a Dynamic value is an float, and return the float if
8282
/// it is.
8383
///
8484
/// ## Examples
@@ -92,7 +92,7 @@ pub external fn int(from: Dynamic) -> Result(Int, String) =
9292
pub external fn float(from: Dynamic) -> Result(Float, String) =
9393
"gleam_stdlib" "decode_float"
9494

95-
/// Check to see whether a Dynamic value is an atom, and return the atom if
95+
/// Checks to see whether a Dynamic value is an atom, and return the atom if
9696
/// it is.
9797
///
9898
/// ## Examples
@@ -107,7 +107,7 @@ pub external fn float(from: Dynamic) -> Result(Float, String) =
107107
pub external fn atom(from: Dynamic) -> Result(atom.Atom, String) =
108108
"gleam_stdlib" "decode_atom"
109109

110-
/// Check to see whether a Dynamic value is an bool, and return the bool if
110+
/// Checks to see whether a Dynamic value is an bool, and return the bool if
111111
/// it is.
112112
///
113113
/// ## Examples
@@ -121,7 +121,7 @@ pub external fn atom(from: Dynamic) -> Result(atom.Atom, String) =
121121
pub external fn bool(from: Dynamic) -> Result(Bool, String) =
122122
"gleam_stdlib" "decode_bool"
123123

124-
/// Check to see whether a Dynamic value is a function that takes no arguments,
124+
/// Checks to see whether a Dynamic value is a function that takes no arguments,
125125
/// and return the function if it is.
126126
///
127127
/// ## Examples
@@ -137,7 +137,7 @@ pub external fn bool(from: Dynamic) -> Result(Bool, String) =
137137
pub external fn thunk(from: Dynamic) -> Result(fn() -> Dynamic, String) =
138138
"gleam_stdlib" "decode_thunk"
139139

140-
/// Check to see whether a Dynamic value is a list, and return the list if it
140+
/// Checks to see whether a Dynamic value is a list, and return the list if it
141141
/// is.
142142
///
143143
/// If you wish to decode all the elements in the list use the `typed_list`
@@ -154,7 +154,7 @@ pub external fn thunk(from: Dynamic) -> Result(fn() -> Dynamic, String) =
154154
pub external fn list(from: Dynamic) -> Result(List(Dynamic), String) =
155155
"gleam_stdlib" "decode_list"
156156

157-
/// Check to see whether a Dynamic value is a result, and return the result if
157+
/// Checks to see whether a Dynamic value is a result, and return the result if
158158
/// it is
159159
///
160160
/// ## Examples
@@ -188,7 +188,7 @@ pub fn result(from: Dynamic) -> Result(Result(Dynamic, Dynamic), String) {
188188
}
189189
}
190190

191-
/// Check to see whether a Dynamic value is a result of a particular type, and
191+
/// Checks to see whether a Dynamic value is a result of a particular type, and
192192
/// return the result if it is
193193
///
194194
/// The `ok` and `error` arguments are decoders for decoding the `Ok` and
@@ -224,7 +224,7 @@ pub fn typed_result(
224224
}
225225
}
226226

227-
/// Check to see whether a Dynamic value is a list of a particular type, and
227+
/// Checks to see whether a Dynamic value is a list of a particular type, and
228228
/// return the list if it is.
229229
///
230230
/// The second argument is a decoder function used to decode the elements of
@@ -254,7 +254,7 @@ pub fn typed_list(
254254
|> result.then(list.try_map(_, decoder_type))
255255
}
256256

257-
/// Check to see if a Dynamic value is an Option of a particular type, and return
257+
/// Checks to see if a Dynamic value is an Option of a particular type, and return
258258
/// the Option if it is.
259259
///
260260
/// The second argument is a decoder function used to decode the elements of
@@ -284,7 +284,7 @@ pub fn option(
284284
}
285285
}
286286

287-
/// Check to see if a Dynamic value is a map with a specific field, and return
287+
/// Checks to see if a Dynamic value is a map with a specific field, and return
288288
/// the value of the field if it is.
289289
///
290290
/// This will not succeed on a record.
@@ -301,7 +301,7 @@ pub fn option(
301301
pub external fn field(from: Dynamic, named: a) -> Result(Dynamic, String) =
302302
"gleam_stdlib" "decode_field"
303303

304-
/// Check to see if the Dynamic value is a tuple large enough to have a certain
304+
/// Checks to see if the Dynamic value is a tuple large enough to have a certain
305305
/// index, and return the value of that index if it is.
306306
///
307307
/// ## Examples
@@ -318,7 +318,7 @@ pub external fn field(from: Dynamic, named: a) -> Result(Dynamic, String) =
318318
pub external fn element(from: Dynamic, position: Int) -> Result(Dynamic, String) =
319319
"gleam_stdlib" "decode_element"
320320

321-
/// Check to see if the Dynamic value is a 2 element tuple.
321+
/// Checks to see if the Dynamic value is a 2 element tuple.
322322
///
323323
/// If you do not wish to decode all the elements in the tuple use the
324324
/// `typed_tuple2` function instead.
@@ -337,7 +337,7 @@ pub external fn element(from: Dynamic, position: Int) -> Result(Dynamic, String)
337337
pub external fn tuple2(from: Dynamic) -> Result(tuple(Dynamic, Dynamic), String) =
338338
"gleam_stdlib" "decode_tuple2"
339339

340-
/// Check to see if the Dynamic value is a 2 element tuple containing two
340+
/// Checks to see if the Dynamic value is a 2 element tuple containing two
341341
/// specifically typed elements.
342342
///
343343
/// If you wish to decode all the elements in the list use the `typed_tuple2`
@@ -368,11 +368,11 @@ pub fn typed_tuple2(
368368
Ok(tuple(a, b))
369369
}
370370

371-
/// Check to see if the Dynamic value is map.
371+
/// Checks to see if the Dynamic value is map.
372372
///
373373
/// ## Examples
374374
///
375-
/// > import gleam/map
375+
/// > import gleam/map
376376
/// > map(from(map.new()))
377377
/// Ok(map.new())
378378
///
@@ -385,7 +385,7 @@ pub fn typed_tuple2(
385385
pub external fn map(from: Dynamic) -> Result(Map(Dynamic, Dynamic), String) =
386386
"gleam_stdlib" "decode_map"
387387

388-
/// Join multiple decoders into one. When run they will each be tried in turn
388+
/// Joins multiple decoders into one. When run they will each be tried in turn
389389
/// until one succeeds, or they all fail.
390390
///
391391
/// ## Examples

src/gleam/float.gleam

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub type Float =
1717
pub external fn parse(String) -> Result(Float, Nil) =
1818
"gleam_stdlib" "parse_float"
1919

20-
/// Return the string representation of the provided float.
20+
/// Returns the string representation of the provided float.
2121
///
2222
/// ## Examples
2323
/// > to_string(2.3)
@@ -29,7 +29,7 @@ pub fn to_string(f: Float) -> String {
2929
|> string_builder.to_string
3030
}
3131

32-
/// Restrict a Float between a lower and upper bound
32+
/// Restricts a Float between a lower and upper bound
3333
///
3434
/// ## Examples
3535
///

src/gleam/int.gleam

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn absolute_value(num: Int) -> Int {
2020
}
2121
}
2222

23-
/// Parse a given string as an int if possible.
23+
/// Parses a given string as an int if possible.
2424
///
2525
/// ## Examples
2626
///
@@ -33,7 +33,7 @@ pub fn absolute_value(num: Int) -> Int {
3333
pub external fn parse(String) -> Result(Int, Nil) =
3434
"gleam_stdlib" "parse_int"
3535

36-
/// Print a given int to a string.
36+
/// Prints a given int to a string.
3737
///
3838
/// ## Examples
3939
///
@@ -43,7 +43,7 @@ pub external fn parse(String) -> Result(Int, Nil) =
4343
pub external fn to_string(Int) -> String =
4444
"erlang" "integer_to_binary"
4545

46-
/// Print a given int to a string using the base number provided.
46+
/// Prints a given int to a string using the base number provided.
4747
///
4848
/// ## Examples
4949
///
@@ -75,7 +75,7 @@ pub external fn to_base_string(Int, Int) -> String =
7575
pub external fn to_float(a: Int) -> Float =
7676
"erlang" "float"
7777

78-
/// Restrict an Int between a lower and upper bound
78+
/// Restricts an Int between a lower and upper bound
7979
///
8080
/// ## Examples
8181
///

src/gleam/io.gleam

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub fn println(string: String) -> Nil {
2929
Nil
3030
}
3131

32-
/// Print a value to standard output using Erlang syntax.
32+
/// Prints a value to standard output using Erlang syntax.
3333
///
3434
/// The value is returned after being printed so it can be used in pipelines.
3535
///
@@ -68,7 +68,7 @@ pub type GetLineError {
6868
/// # Example
6969
///
7070
/// > io.get_line("Language: ")
71-
/// // -> Language: <- gleam
71+
/// // -> Language: <- gleam
7272
/// Ok("gleam\n")
7373
///
7474
pub external fn get_line(prompt: String) -> Result(String, GetLineError) =

0 commit comments

Comments
 (0)