Commits

Meikel Brandmeyer  committed 332cab2

make-monad constructor

Added the make-monad constructor to abstract the struct-map call away.

  • Participants
  • Parent commits 83e1492

Comments (0)

Files changed (1)

File de/kotka/monad/monad.clj

   monad-structure
   (create-struct :monad))
 
+(defn make-monad
+  "Synopsis
+  --------
+
+  (make-monad monad-type key value ...)
+
+  Description
+  -----------
+
+  `make-monad` creates a new monad structure and associates the :monad key
+  with given monad-type. What the monad-type actually is, is up to the caller.
+  This value will be used for dispatching in the `bind` multimethod.
+
+  Any further key-value pairs will be associated with the map."
+  [monad-type & kvs]
+  (apply struct-map monad-structure :monad monad-type kvs))
+
 (defmulti
   #^{:doc
   "Synopsis