diff options
author | RJ Dellecese <rjdellecese@gmail.com> | 2019-12-28 21:29:11 -0500 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-12-30 22:36:04 +0000 |
commit | 9292225d996c2092647fae15726a9f9bb2a691c8 (patch) | |
tree | 3e2b4edfcbe34c54eb279cd59924e9fc0ce13590 /gen/src | |
parent | a37c8fcf7b8ed522bc7c23dc25c3a804f7728adb (diff) | |
download | gleam_stdlib-9292225d996c2092647fae15726a9f9bb2a691c8.tar.gz gleam_stdlib-9292225d996c2092647fae15726a9f9bb2a691c8.zip |
Add generic module
Containing identity, always, flip, and compose functions.
Diffstat (limited to 'gen/src')
-rw-r--r-- | gen/src/gleam@generic.erl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gen/src/gleam@generic.erl b/gen/src/gleam@generic.erl new file mode 100644 index 0000000..a25a59f --- /dev/null +++ b/gen/src/gleam@generic.erl @@ -0,0 +1,16 @@ +-module(gleam@generic). +-compile(no_auto_import). + +-export([identity/1, always/2, flip/1, compose/2]). + +identity(A) -> + A. + +always(_, B) -> + B. + +flip(Fun) -> + fun(B, A) -> Fun(A, B) end. + +compose(Fun1, Fun2) -> + fun(A) -> Fun2(Fun1(A)) end. |