diff --git a/resources/clj-kondo.exports/de.active-group/active-clojure/config.edn b/resources/clj-kondo.exports/de.active-group/active-clojure/config.edn index 8e2ea5e..f914e47 100644 --- a/resources/clj-kondo.exports/de.active-group/active-clojure/config.edn +++ b/resources/clj-kondo.exports/de.active-group/active-clojure/config.edn @@ -2,5 +2,6 @@ :hooks {:analyze-call {active.clojure.monad/monadic hooks.monad/monadic active.clojure.cljs.record/define-record-type hooks.record/define-record-type active.clojure.cljs.record/define-singleton-type hooks.record/define-singleton-type + active.clojure.sum-type/define-sum-type hooks.sum-type/define-sum-type active.clojure.record/define-record-type hooks.record/define-record-type active.clojure.record/define-singleton-type hooks.record/define-singleton-type}}} diff --git a/resources/clj-kondo.exports/de.active-group/active-clojure/hooks/sum_type.clj b/resources/clj-kondo.exports/de.active-group/active-clojure/hooks/sum_type.clj new file mode 100644 index 0000000..287fc76 --- /dev/null +++ b/resources/clj-kondo.exports/de.active-group/active-clojure/hooks/sum_type.clj @@ -0,0 +1,13 @@ +(ns hooks.sum-type + (:require [clj-kondo.hooks-api :as api])) + +(defn define-sum-type + [expr] + (update expr :node + (fn [node] + (let [[sum-type-name predicate] (rest (:children node))] + (api/list-node + (list (api/token-node 'do) + (api/list-node [(api/token-node 'declare) sum-type-name]) + (api/list-node [(api/token-node 'declare) predicate]))))))) +