 
 (ns cats.monad.identity
   "The Identity Monad."
-  (:require [cats.protocols :as proto])
+  (:require [cats.protocols :as p])
   (:refer-clojure :exclude [identity]))
 
 (declare identity-monad)

         (str v))])

  #?@(:cljs
       [cljs.core/IEquiv
        (-equiv [_ other]
                (if (instance? Identity other)
                  (= v (.-v other))
                  false))]))

(alter-meta! #'->Identity assoc :private true)


(def ^{:no-doc true}
  identity-monad
  (reify
    p/Functor
    (fmap [_ f iv]
      (Identity. (f (.-v iv))))

    p/Applicative
    (pure [_ v]
      (Identity. v))

    (fapply [_ af av]
      (Identity. ((.-v af) (.-v av))))

    p/Monad
    (mreturn [_ v]
      (Identity. v))

