Commits

Meikel Brandmeyer committed 4868a33

Added eval-state and exec-state

* monad/state.clj (eval-state, exec-state): new functions

  • Participants
  • Parent commits 220a457

Comments (0)

Files changed (1)

File src/de/kotka/monad/state.clj

   [m s]
   ((monad m) s))
 
+(defvar
+  eval-state
+  (comp first run-state)
+  "Run the given state monad and return its value. Equivalent to run-state
+  followed by first.")
+
+(defvar
+  exec-state
+  (comp second run-state)
+  "Run the given state monad and return its final state. Equivalent to
+  run-state followed by second.")
+
 (defmethod bind ::type
   [m f]
   (return ::type