Hello everyone. Do you folks know any lib that provides clojure.specs for core.async?
that's challenging in several different ways, so what exactly are you looking for?
spec for the existing core.async api or the ability to use specs for your data flowing through channels?
(defn chan? [x] (instance? clojure.core.async.impl.channels.ManyToManyChannel x))
if you just want to check if something is a chanwhile that will kind of work right now, it's not really the right spec and is likely to eventually not work
channels implements ReadPort and WritePort protocols and most core.async functions should be thought of as taking/returning one of those. It's possible to just implement one of those port contracts and not be an instance of channel and satisfy core.async
Good to know
That's cool, but I was thinking more about specs for the existing core.async api.
Do we have something like that?
no, core.async predates spec by a couple years
I'm not sure most of it would give you a lot of value by being spec'ed, and some of the ! /go stuff is probably interesting with respect to combination with specs
I would get a lot of value out of a chan?
predicate that I could use in my :pre/:post
-conditions in both Clojure and ClojureScript.
There's discussion about it here: https://clojure.atlassian.net/browse/ASYNC-74
Oh wait, you commented there 🙂
I'm not actually missing it, I'm learning core.async
and documentation and guides are fine. I was just wondering that since spec is becoming a "standard" in Clojure, every library would have it, but maybe that is not the case.
a lot of libs still try to support older clojure versions pre-spec too
until recently, that included core.async
but newest versions bumped minimum to 1.9