aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/abstract
diff options
context:
space:
mode:
authorEduardo Julian2019-11-07 22:32:32 -0400
committerEduardo Julian2019-11-07 22:32:32 -0400
commita23315e79ff58024134e5d20b4a4cb5bd8050152 (patch)
treea4488a77fba13683eb17e74d69ec701b4d12e4d0 /stdlib/source/lux/abstract
parentaab604028e117e505bc408f69dc416fe6d9f46a7 (diff)
WIP: Major refactoring of JVM bytecode machinery.
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/abstract/equivalence.lux4
-rw-r--r--stdlib/source/lux/abstract/monad.lux7
2 files changed, 10 insertions, 1 deletions
diff --git a/stdlib/source/lux/abstract/equivalence.lux b/stdlib/source/lux/abstract/equivalence.lux
index d23f37942..eacb4a48f 100644
--- a/stdlib/source/lux/abstract/equivalence.lux
+++ b/stdlib/source/lux/abstract/equivalence.lux
@@ -35,7 +35,9 @@
(def: (= left right)
(sub (rec sub) left right))))
-(structure: #export contravariant (Contravariant Equivalence)
+(structure: #export contravariant
+ (Contravariant Equivalence)
+
(def: (map-1 f equivalence)
(structure
(def: (= reference sample)
diff --git a/stdlib/source/lux/abstract/monad.lux b/stdlib/source/lux/abstract/monad.lux
index f0444a4cf..5aec10012 100644
--- a/stdlib/source/lux/abstract/monad.lux
+++ b/stdlib/source/lux/abstract/monad.lux
@@ -87,6 +87,13 @@
_
(#.Left "Wrong syntax for 'do'")))
+(def: #export (bind monad f)
+ (All [! a b]
+ (-> (Monad !) (-> a (! b))
+ (-> (! a) (! b))))
+ (|>> (:: monad map f)
+ (:: monad join)))
+
(def: #export (seq monad)
{#.doc "Run all the monadic values in the list and produce a list of the base values."}
(All [M a]