This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-12
Channels
- # beginners (34)
- # boot (210)
- # cider (16)
- # cljs-dev (65)
- # cljsrn (3)
- # clojars (2)
- # clojure (107)
- # clojure-austin (8)
- # clojure-berlin (10)
- # clojure-brasil (1)
- # clojure-canada (1)
- # clojure-dev (1)
- # clojure-fr (1)
- # clojure-italy (22)
- # clojure-new-zealand (12)
- # clojure-nl (28)
- # clojure-russia (13)
- # clojure-spec (25)
- # clojure-uk (10)
- # clojurescript (109)
- # cursive (18)
- # datomic (44)
- # defnpodcast (1)
- # dirac (4)
- # emacs (2)
- # funcool (1)
- # hoplon (16)
- # jobs (14)
- # lambdaisland (23)
- # leiningen (2)
- # luminus (3)
- # off-topic (7)
- # om (58)
- # onyx (16)
- # proton (6)
- # re-frame (42)
- # reagent (55)
- # ring-swagger (5)
- # untangled (47)
- # vim (9)
you can fdef a protocol function, and you'll be able to validate it, but instrument may behave oddly
I found instrument doesn't work, I make my protocol functions a simple proxy to another function that I can spec
Has anyone had any success spec'ing high level components, such as ring handlers? I would like to spec boundaries rather than implementation details in an app I'm working on and it seems like this will be a ton of work.
@danielstockton That's what I'm doing for now. It would be really nice if instrument worked, though. 🙂
@alexmiller Is that something worth submitting as a feature request? Or is unlikely to be considered?
@hiredman So I can do something like this?
(defprotocol Foo
(bar [this]))
(s/fdef bar
:args (s/cat :x int?
:y int?)
:ret string?)
(defrecord MyFoo [_]
Foo
(bar [_] (str a "+" b))
It was asked before on the google group: https://groups.google.com/forum/#!topic/clojure/f068WTgakpk
I'm not sure it's possible to do
I'm certainly not opposed to it
There is sorted-map? predicate
I think? On phone so going from memory
Trying to use spec, and have a problem with setting up my spec ... basically i want style? to be one of those two values (for now :one :two) ... but it is not working, i've been studying the docs and i can't figure out where i am doing something wrong .
@clojuregeek - i think you want to either do (def style? #{:one :two})
and (s/def ::style style?)
, or just (s/def ::style #{:one :two})
i don’t think (s/def) expects you to give it a symbol like style?
as the first argument, i think it expects a namespaced keyword like ::style
also you have ::style?? in there at one point, which is probably confusing things as well
yes, you've registered the spec under the symbol style?
instead of under the keyword ::style?
ok let me try some more ..
ok i think maybe it was extra ? on style in job not a keyword when i defined style? spec
thanks guys 👍
now if i can only stop typing confirm instead of conform 🙂