From 10af1307dddc5cb89596c92d3fbb5a8c4491eec1 Mon Sep 17 00:00:00 2001 From: RJ Dellecese Date: Mon, 30 Dec 2019 14:06:52 -0500 Subject: Rename generic module as function module --- src/gleam/function.gleam | 11 +++++++++++ src/gleam/generic.gleam | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 src/gleam/function.gleam delete mode 100644 src/gleam/generic.gleam (limited to 'src') diff --git a/src/gleam/function.gleam b/src/gleam/function.gleam new file mode 100644 index 0000000..35423c0 --- /dev/null +++ b/src/gleam/function.gleam @@ -0,0 +1,11 @@ +// 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 { + fn(b, a) { fun(a, b) } +} + +// Takes two functions and chains them together to form one function that takes +// the input from the first and returns the output of the second. +pub fn compose(fun1: fn(a) -> b, fun2: fn(b) -> c) -> fn(a) -> c { + fn(a) { fun1(a) |> fun2 } +} diff --git a/src/gleam/generic.gleam b/src/gleam/generic.gleam deleted file mode 100644 index 35423c0..0000000 --- a/src/gleam/generic.gleam +++ /dev/null @@ -1,11 +0,0 @@ -// 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 { - fn(b, a) { fun(a, b) } -} - -// Takes two functions and chains them together to form one function that takes -// the input from the first and returns the output of the second. -pub fn compose(fun1: fn(a) -> b, fun2: fn(b) -> c) -> fn(a) -> c { - fn(a) { fun1(a) |> fun2 } -} -- cgit v1.2.3