aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2020-01-13 22:35:30 +0000
committerLouis Pilfold <louis@lpil.uk>2020-01-13 22:39:29 +0000
commitc46f76f16ead267506629093a988861accf00721 (patch)
treedbc5cbba058ea757fb3353e522d1ca7607d1d2b2
parent709bec419cee078ca9770991606ccc484dd0f1c1 (diff)
downloadgleam_stdlib-c46f76f16ead267506629093a988861accf00721.tar.gz
gleam_stdlib-c46f76f16ead267506629093a988861accf00721.zip
Type annotations for gleam/pair
-rw-r--r--src/gleam/pair.gleam10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gleam/pair.gleam b/src/gleam/pair.gleam
index 1637034..4cbce53 100644
--- a/src/gleam/pair.gleam
+++ b/src/gleam/pair.gleam
@@ -1,24 +1,24 @@
-pub fn first(pair) {
+pub fn first(pair: tuple(a, b)) -> a {
let tuple(a, _) = pair
a
}
-pub fn second(pair) {
+pub fn second(pair: tuple(a, b)) -> b {
let tuple(_, a) = pair
a
}
-pub fn swap(pair) {
+pub fn swap(pair: tuple(a, b)) -> tuple(b, a) {
let tuple(a, b) = pair
tuple(b, a)
}
-pub fn map_first(of pair, with fun) {
+pub fn map_first(of pair: tuple(a, b), with fun: fn(a) -> c) -> tuple(c, b) {
let tuple(a, b) = pair
tuple(fun(a), b)
}
-pub fn map_second(of pair, with fun) {
+pub fn map_second(of pair: tuple(a, b), with fun: fn(b) -> c) -> tuple(a, c) {
let tuple(a, b) = pair
tuple(a, fun(b))
}