diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/pair.gleam | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gleam/pair.gleam b/src/gleam/pair.gleam index e9b99fd..894e6a8 100644 --- a/src/gleam/pair.gleam +++ b/src/gleam/pair.gleam @@ -69,3 +69,17 @@ pub fn map_second(of pair: #(a, b), with fun: fn(b) -> c) -> #(a, c) { let #(a, b) = pair #(a, fun(b)) } + +/// Returns a new pair with the given elements. This can also be done using the dedicated +/// syntax instead: `new(1, 2) == #(1, 2)`. +/// +/// ## Examples +/// +/// ```gleam +/// > new(1, 2) +/// #(1, 2) +/// ``` +/// +pub fn new(first: a, second: b) -> #(a, b) { + #(first, second) +} |