aboutsummaryrefslogtreecommitdiff
path: root/src/lang/util.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/lang/util.clj')
-rw-r--r--src/lang/util.clj9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lang/util.clj b/src/lang/util.clj
index d9745e9ab..ec93ac27f 100644
--- a/src/lang/util.clj
+++ b/src/lang/util.clj
@@ -112,3 +112,12 @@
(def get-state
(fn [state]
(return* state state)))
+
+(defn within [slot monad]
+ (fn [state]
+ (let [=return (monad (get state slot))]
+ (match =return
+ [::ok [?state ?value]]
+ [::ok [(assoc state slot ?state) ?value]]
+ _
+ =return))))