       (assoc-in db p (handler (get-in db p) v)))))
 
 
-;; warning: untested
 (defn validate
   "Middleware that applies a validation function to the db after the handler is finished.
 The validation function f, might assoc warnings and errors to the new state, created by the handler.

  (:require
    [reagent.ratom  :refer [IReactiveAtom]]
    [re-frame.undo  :refer [store-now!]]
    [re-frame.utils :refer [warn]]))


;; Read this:  https://github.com/Day8/re-frame/wiki/Middleware


(defn pure
  "Middleware which adapts a pure handler to the non-pure standard calling convention"
  [handler]
  (fn new-handler
    [app-db event-vec]
    (assert (satisfies? IReactiveAtom app-db)
            (str "re-frame: pure not given a Ratom" (if (map? app-db) ". Perhaps \"pure\" is used twice.")))
    (reset! app-db (handler @app-db event-vec))))



;; warning: untested



;; warning: untested
#_(defn log-events
  "Middleware that logs events (vec) using to the given logger fucntion"
  [logger]
  (fn middleware
