aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/codata/function.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/codata/function.lux23
1 files changed, 23 insertions, 0 deletions
diff --git a/stdlib/source/lux/codata/function.lux b/stdlib/source/lux/codata/function.lux
new file mode 100644
index 000000000..fba5528a8
--- /dev/null
+++ b/stdlib/source/lux/codata/function.lux
@@ -0,0 +1,23 @@
+## Copyright (c) Eduardo Julian. All rights reserved.
+## This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
+## If a copy of the MPL was not distributed with this file,
+## You can obtain one at http://mozilla.org/MPL/2.0/.
+
+(;module:
+ lux
+ (lux (control monoid)))
+
+## [Functions]
+(def: #export (const x y)
+ (All [a b] (-> a (-> b a)))
+ x)
+
+(def: #export (flip f)
+ (All [a b c]
+ (-> (-> a b c) (-> b a c)))
+ (lambda [x y] (f y x)))
+
+## [Structures]
+(struct: #export Monoid<Function> (Monoid (All [a] (-> a a)))
+ (def: unit id)
+ (def: append .))