Skip to content

Instantly share code, notes, and snippets.

@souenzzo
Created Apr 13, 2021
Embed
What would you like to do?
(def spy-plugin
{::pc/wrap-resolve (fn [resolve]
(fn [env input]
(let [resolver-sym (-> env ::pc/resolver-data ::pc/sym)
_ (prn {:sym resolver-sym
:input input
:entity (p/entity env)})
output (resolve env input)]
(prn {:sym resolver-sym
:output output
:entity (p/entity env)})
output)))})
(let [parser (p/parser {::p/plugins [(pc/connect-plugin)
spy-plugin]})
indexes (pc/register {}
[(pc/constantly-resolver :a 42)
(pc/single-attr-resolver :a :c inc)])
env {::p/reader [p/map-reader
pc/reader2
pc/open-ident-reader
p/env-placeholder-reader]
::pc/indexes indexes
::p/placeholder-prefixes #{">"}}]
(parser env [:c]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment