diff options
Diffstat (limited to '')
-rw-r--r-- | src/lang/util.clj | 9 |
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)))) |