Commits

Meikel Brandmeyer committed 1c33a9d

Replaced lift with lift-into

* monad.clj (lift, lift-into): removed lift since it wasn't correct anyway

Comments (0)

Files changed (1)

src/de/kotka/monad.clj

       `(bind ~monad (fn [~v] ~@body))
       `(bind ~monad (fn [~v] (let-bind ~clauses ~@body))))))
 
-(defmacro lift
-  "Call the given function f with the values of all given monads in the
-  same order. f should again return a monad."
-  [f & ms]
+(defmacro lift-into
+  "Call the given function f into the given monad with the values of
+  all given monads in the same order."
+  [m f & ms]
   (let [xs (take (count ms) (drop 1 (iterate gensym "lift__")))]
-    `(let-bind ~(vec (interleave xs ms)) (~f ~@xs))))
+    `(let-bind ~(vec (interleave xs ms)) (return ~m (~f ~@xs)))))