 
 #_(pp)
 
-(defmethod error-help-message :failed-predicate [{:keys [path not value]}]
-  [:group "The key "
-   (color (pr-str (first path)) :bold)
-   " has the wrong value. It should be a "
-   (color (explain-predicate-failure not value) :green)])
-
-(defmethod error-help-message :combined-failed-predicate [{:keys [path not value]}]
-  [:group "The key "
-   (color (pr-str (first path))
-          :bold)
-   " has the wrong value. It can one of the following: "
-   (cons :span (interpose ", "
-                      (map #(color % :green)
-                           (map #(explain-predicate-failure % value) (butlast not)))))
-   " or " (color (pr-str (last not)) :green)])
+(defmethod error-help-message :failed-predicate [{:keys [path not value type-sig] :as error}]
+  (concat
+   (if (parent-is-sequence? error)
+     [:group "The sequence at key " (color (pr-str (second path)) :bold)
+      " contains bad value " (color (pr-str value) :red) ". "]
+     [:group "The key "
+      (color (pr-str (first path)) :bold)
+      " has the wrong value. "])
+   ["It should be a "
+    (color (explain-predicate-failure not value) :green)]))
+
+(defmethod error-help-message :combined-failed-predicate [{:keys [path not value] :as error}]
+  (concat
+   (if (parent-is-sequence? error)
+     [:group "The sequence at key "  (format-key (second path) :bold)
+     " contains bad value " (color (pr-str value) :red) ". "]
+     [:group "The key "
+      (format-key (first path) :bold)
+      " has the wrong value. "
+      ])
+   [
+    "It can one of the following: "
+    (cons :span (interpose ", "
+                           (map #(color % :green)
+                                (map #(explain-predicate-failure % value) (butlast not)))))
+    " or " (color (pr-str (last not)) :green)]))
 
 #_(error-help-message {:Error :combined-failed-predicate :path [:boolean] :value 5 :not [true false]})
 

(defmethod explain-predicate-failure :SEQQ [pred value] "Sequence")

(defmulti error-help-message :Error)

(defmethod error-help-message :missing-required-key [{:keys [path key]}]
  [:group "Missing required key "

  (mapcat (fn [{:keys [key type-sig value] :as error}]
            (let [typ (first type-sig)
                  err' (unknown-key-error-help root-type typ key value)]
              (if (empty? err')
                [(assoc error :Error (:Error-type error))]
                (map #(assoc %
                           :path (:path error)
                           :value (:value error)
                           :type-sig (:type-sig error)
                           :orig-error error) err'))
              ))
        errors))

(defn type-check [root-type value]
