      (checked @global-type-repo name kvs)))
 
 (defn instance? 
+  "Return `true` iff the map or record `kvs` typechecks against the type named `name` in
+   `type-repo`. If `type-repo` is omitted, the global repo is used.
+   
+       (type/instance? :frobbable kvs)
+"
   ([type-repo name kvs]
      (checked (assoc type-repo
                      :failure-handler (constantly false) 

(defn- checked-internal [type-repo name kvs]
  (let [[errors actual] (b/validate kvs (get-in type-repo [:validators name]))]
    (if (empty? errors)
      ((success-handler type-repo) kvs)
      (-> ( (formatter type-repo) errors (dissoc actual :bouncer.core/errors))
          ((failure-handler type-repo))))))

(defn named [type-repo name keys]
  (checked-internal own-types :type-repo type-repo)
  (named-internal type-repo name keys))

(defn checked
  ([type-repo name kvs]
     (checked-internal own-types :type-repo type-repo)
     (checked-internal type-repo name kvs))

  ([name kvs]
     (instance? @global-type-repo name kvs)))

(defn coercion 
  "Register function `f` as one that can coerce a map or record into 
   one that matches type `name`. The updated `type-repo` is returned.
   See also [[coercion!]], which updates the global type repo."
  [type-repo name f]
  (checked-internal own-types :type-repo type-repo)
  (assoc-in type-repo [:coercions name] f))

(defn coerce
  "Coerce the map or record `kvs` into the type named `name` in the `type-repo`
   and check the result with [[checked]]. The coerced version of `kvs` is returned.
   
   If the type repo is omitted, the global type repo is used.
   Coercions are defined with [[coercion]] or [[coercion!]].
   
        (some-> (coerce :user-v2 legacy-json)
                (update-in [:stats :logins] inc))

   If `name` hasn't been defined (via [[name]] or [[named!]]), the final
   call to `checked` is omitted.
"
  ([type-repo name kvs]
     (checked-internal own-types :type-repo type-repo)
     (let [coercer (get-in type-repo [:coercions name] identity)]
