diff options
author | RJ Dellecese <rjdellecese@gmail.com> | 2019-12-30 14:06:16 -0500 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-12-30 22:36:04 +0000 |
commit | ff9157674da3863512a2f068d9df02236d0652dc (patch) | |
tree | d607f43b1238d3437dd1661a040aadd549fba2a2 | |
parent | bba9a3639733cf8327f63c9a25afc615a04f7a6f (diff) | |
download | gleam_stdlib-ff9157674da3863512a2f068d9df02236d0652dc.tar.gz gleam_stdlib-ff9157674da3863512a2f068d9df02236d0652dc.zip |
Remove identity and always functions
-rw-r--r-- | gen/src/gleam@generic.erl | 8 | ||||
-rw-r--r-- | gen/test/gleam@generic_test.erl | 8 | ||||
-rw-r--r-- | src/gleam/generic.gleam | 6 | ||||
-rw-r--r-- | test/gleam/generic_test.gleam | 14 |
4 files changed, 3 insertions, 33 deletions
diff --git a/gen/src/gleam@generic.erl b/gen/src/gleam@generic.erl index a25a59f..c616d93 100644 --- a/gen/src/gleam@generic.erl +++ b/gen/src/gleam@generic.erl @@ -1,13 +1,7 @@ -module(gleam@generic). -compile(no_auto_import). --export([identity/1, always/2, flip/1, compose/2]). - -identity(A) -> - A. - -always(_, B) -> - B. +-export([flip/1, compose/2]). flip(Fun) -> fun(B, A) -> Fun(A, B) end. diff --git a/gen/test/gleam@generic_test.erl b/gen/test/gleam@generic_test.erl index eecf650..0d4abe4 100644 --- a/gen/test/gleam@generic_test.erl +++ b/gen/test/gleam@generic_test.erl @@ -1,13 +1,7 @@ -module(gleam@generic_test). -compile(no_auto_import). --export([identity_test/0, always_test/0, flip_test/0, compose_test/0]). - -identity_test() -> - gleam@expect:equal(gleam@generic:identity(1), 1). - -always_test() -> - gleam@expect:equal(gleam@generic:always(1, 2), 2). +-export([flip_test/0, compose_test/0]). flip_test() -> Fun = fun(String, Int) -> diff --git a/src/gleam/generic.gleam b/src/gleam/generic.gleam index d821ac7..35423c0 100644 --- a/src/gleam/generic.gleam +++ b/src/gleam/generic.gleam @@ -1,9 +1,3 @@ -// A function that returns exactly what it was given. -pub fn identity(a: a) -> a { a } - -// A function that, given two values, ignores one and always returns the other. -pub fn always(_a: a, b: b) -> b { b } - // Takes a function that takes two arguments and returns a new function that // takes the same two arguments, but in reverse order. pub fn flip(fun: fn(a, b) -> c) -> fn(b, a) -> c { diff --git a/test/gleam/generic_test.gleam b/test/gleam/generic_test.gleam index a65e931..7088edb 100644 --- a/test/gleam/generic_test.gleam +++ b/test/gleam/generic_test.gleam @@ -1,22 +1,10 @@ import gleam/expect -import gleam/generic.{identity, always, flip, compose} +import gleam/generic.{flip, compose} import gleam/int as int_mod import gleam/list import gleam/result import gleam/string as string_mod -pub fn identity_test() { - 1 - |> identity - |> expect.equal(_, 1) -} - -pub fn always_test() { - 1 - |> always(_, 2) - |> expect.equal(_, 2) -} - pub fn flip_test() { let fun = fn(string: String, int: Int) { string |