aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/abstract
diff options
context:
space:
mode:
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]