From 3599e3c29c16c2cfd12c76a5dcbe6d55e9f396d3 Mon Sep 17 00:00:00 2001 From: Tristan Cacqueray Date: Mon, 6 Dec 2021 22:23:03 +0000 Subject: Add function.constant This change adds a new helper to the function module. --- test/gleam/function_test.gleam | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/gleam/function_test.gleam b/test/gleam/function_test.gleam index e86beb3..1495d2a 100644 --- a/test/gleam/function_test.gleam +++ b/test/gleam/function_test.gleam @@ -2,6 +2,7 @@ import gleam/should import gleam/dynamic import gleam/function import gleam/int +import gleam/pair import gleam/list import gleam/result import gleam/string @@ -107,3 +108,9 @@ pub fn identity_test() { |> function.identity |> should.equal(#(1, 2.0)) } + +pub fn always_test() { + #(1, 2) + |> pair.map_first(function.constant(42)) + |> should.equal(#(42, 2)) +} -- cgit v1.2.3