Skip to content

Instantly share code, notes, and snippets.

View fbellomi's full-sized avatar

Francesco Bellomi fbellomi

View GitHub Profile
@fbellomi
fbellomi / gist:9832211d53bd0a1dd49b
Last active August 29, 2015 14:14
Pretty printer for core.typed annotations
(defn pp-type [f]
(if (and (sequential? f) (<= 3 (count f)) (symbol? (first f)) (= (name (first f)) "All"))
(str "(All " (pr-str (second f)) "\n " (str/join "\n " (str/split (pp-type (nth f 2)) #"\n" )) ")")
(if (and (sequential? f) (<= 3 (count f)) (symbol? (first f)) (= (name (first f)) "IFn"))
(str "(IFn " (str/join "\n " (map pr-str (rest f))) ")")
(pr-str f))))
(defn pretty-print-type [f]
(-> (pp-type f)