Commits

Meikel Brandmeyer committed c72911f

Added monad-type utility

* monad.clj (monad-type): new function. All callers changed.

Comments (0)

Files changed (1)

src/de/kotka/monad.clj

   [m]
   (m :monad))
 
+(defn monad-type
+  "Return the type of a blessed object."
+  [m]
+  (m :type))
+
 (defmulti
   #^{:doc
   "bind makes the value of the given monad available to a function.
   The function may act on the value, but it must return another monad.
   Although this cannot be enforced in Clojure."}
-  bind (fn [m _] (m :type)))
+  bind (fn [m _] (monad-type m)))
 
 (defmacro let-bind
   "let-bind binds the result of the given monads to the given variables