pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
imre 2021-01-16T08:20:28.010200Z

This ^

Reily Siegel 2021-01-16T16:00:27.010800Z

Does Pathom3 provide the parser in the env? I want to be able to resolve attributes in mutations, and would presumably need access to the parser.

wilkerlucio 2021-01-16T16:12:55.011700Z

I did some play here, and I checked its possible to also implement a promesa protocol to make other async things fulfill it, here is an example using core.async via said extension:

(extend-type cljs.core.async.impl.channels/ManyToManyChannel
  promesa.protocols/IPromiseFactory
  (-promise [this]
    (p/create
      (fn [resolve reject]
        (go
          (let [v (<! this)]
            (if (error? v)
              (reject v)
              (resolve v))))))))

(comment
  (let [start (system-time)]
    (-> (p.a.eql/process (pci/register
                           (pco/resolver 'foo {::pco/output [:foo-async]}
                             (fn [_ _] (go {:foo-async "the-value"}))))
          [:foo-async])

        (p/handle (fn [result error]
                    (println "RES" result error))))))

wilkerlucio 2021-01-16T16:13:41.011900Z

Pathom 3 just uses the env directly for everything, no need for parser

wilkerlucio 2021-01-16T16:14:01.012100Z

you can use the env to trigger p.eql/process from inside the mutation

wilkerlucio 2021-01-16T16:14:04.012300Z

makes sense?

Reily Siegel 2021-01-16T16:14:14.012500Z

Yep, thanks

wilkerlucio 2021-01-16T16:16:38.012700Z

I probably wont provide this in the library to avoid having the dep on core.async at all, but it can be a separated library, or a documentation page with the snippet

wilkerlucio 2021-01-16T16:16:56.012900Z

what you think?

mpenet 2021-01-16T17:00:09.013500Z

Good approach. I really like core.async myself but having completablefutures is a good default, especially on the jvm. And it's easy to plug one into the others (you can make completablefuture impl for core. async readport/writeport that follows promise-chan impl, then overhead is really low I guess)

mpenet 2021-01-16T17:01:28.013700Z

I wouldn't bake in interceptor usage tho, this is more opinionated, there's no standard and there are multiple good impl. in clojure with subtle differences.

1👍