            [~kw-tag (hash-map ~@(interleave kw-members members))])
          nil)))
 
-(defmacro defvariant [variant-name]
+(defmacro defvariant
+  "Defines a function over an open variant and a predicate returning true if the
+  function is implemented for a given tagged value.
+
+  Ex. => (defvariant foo)
+      nil
+      => (deftag a [a b c])
+      nil
+      => (foo (a 1 2 3))
+      ;; No Such Method exception
+      => (foo? (a 1 2 3))
+      false"
+  [variant-name]
   (let [pred-name    (symbol (str (name variant-name) "?"))
         default-case (keyword (name (gensym)))]
     `(do (defmulti ~pred-name first

         (defmethod ~pred-name ~default-case [& _#] false)
         nil)))

(defmacro extend-variant [name tag args & body]
  (let [variant-var  (resolve name)
        variant-meta (meta variant-var)
        _            (assert (get variant-meta :variants/variant) "Tried to extend a non-variant!")

    `(do (defmethod ~name         ~tag-keyword [[_# ~@args]] ~@body)
         (defmethod ~variant-pred ~tag-keyword [& _#] true)
         nil)))

(comment
  (do (deftag foo [a])
      (deftag qux [b])
      (defvariant f-of-foo)
      (extend-variant f-of-foo foo [{:a a}] (println a))
      (f-of-foo? (foo 1)) ;; -> true
      (f-of-foo  (foo 1)) ;; prints 1
      (f-of-foo? (bar 1)) ;; -> false
      ))
