diff --git a/resources/clj-kondo.exports/funcool/promesa/config.edn b/resources/clj-kondo.exports/funcool/promesa/config.edn index 1844f77..61f0f31 100644 --- a/resources/clj-kondo.exports/funcool/promesa/config.edn +++ b/resources/clj-kondo.exports/funcool/promesa/config.edn @@ -2,7 +2,7 @@ promesa.core/->> clojure.core/->> promesa.core/as-> clojure.core/as-> promesa.core/let clojure.core/let - promesa.core/plet clojure.core/let + promesa.core/plet funcool.promesa/plet promesa.core/loop clojure.core/loop promesa.core/recur clojure.core/recur promesa.core/with-redefs clojure.core/with-redefs diff --git a/resources/clj-kondo.exports/funcool/promesa/funcool/promesa.clj b/resources/clj-kondo.exports/funcool/promesa/funcool/promesa.clj new file mode 100644 index 0000000..1e21eec --- /dev/null +++ b/resources/clj-kondo.exports/funcool/promesa/funcool/promesa.clj @@ -0,0 +1,16 @@ +(ns funcool.promesa + (:require [clj-kondo.hooks-api :as api])) + +(defn plet + ;; this effectively rewrites the let to `(let [[bind1 bind2] [(expr-1) (expr-2)] ,,,) + ;; making referring to other binding syms produce an error + ;; thanks to @NoahBogart on Slack for this + [{:keys [:node]}] + (let [[_plet binds & body] (:children node) + new-bind-syms (api/vector-node (take-nth 2 (:children binds))) + new-bind-exprs (api/vector-node (take-nth 2 (rest (:children binds)))) + new-node (api/list-node + (list* (api/token-node 'clojure.core/let) + (api/vector-node [new-bind-syms new-bind-exprs]) + body))] + {:node new-node}))