Fork me on GitHub
#clojure-spec
<
2017-05-26
>
jfntn00:05:26

@alexmiller the workaround was to move the self spec before the parent

Alex Miller (Clojure team)00:05:42

hmm, fails on Clojure too - I think this is related to a couple other existing tickets where s/def chases the spec too early

gfredericks00:05:16

I wrote a defn macro that dispatches on specs matching; it didn't make an fdef

wilkerlucio16:05:20

hello people, I wanna share with you a snippet that I wrote here to find bad generators on your project, it's helping me a lot (specially when you have a s/keys filled with items and don't know which of then is not generating)

wilkerlucio16:05:23

(let [keys (->> (s/registry)
                keys
                (filter #(and (qualified-keyword? %)
                              (not (contains? #{"clojure.core.specs.alpha"
                                                "clojure.spec.alpha"} (namespace %))))))]
  (doseq [k keys]
    (try
      (doall (s/exercise k))
      (catch Exception e
        (println "Bad generator for" (pr-str k))))))

wilkerlucio16:05:41

this will print Bad generator for :some/key for the generators that are not being able to find a value after 100 tries

wilkerlucio16:05:21

I hope it may help you as it is helping me 🙂

bbss17:05:14

I'm having an issue generating date-ranges, getting

clojure.test.check.rose_tree.RoseTree cannot be cast to
   clojure.test.check.rose_tree.RoseTree

ghadi17:05:37

looks like an AOT compilation problem ^

bbss17:05:47

it's in cljc

bbss17:05:57

is that something that could be causing it?

ghadi17:05:29

no -- it has to do with whether you have superfluous *.class files present, and whether you've require/reloaded stuff

bbss17:05:41

okay, then it might be because I hotloaded

ghadi17:05:43

calling @hiredman batsignal

bbss17:05:45

let me check that, thanks

ghadi17:05:33

reloading things will redefine some classes. Those classes will have the same name as existing classes, but will be != from the JVM's perspective

bbss17:05:56

makes sense

ghadi17:05:09

thus instances of RoseTree(1) are not instances of RoseTree(2)

hiredman17:05:12

aot drowns kittens in a sack in the river (the kittens are a metaphor for your hopes and deams)

bbss17:05:55

hmm, now I'm running into issues with clj-time.format not being found.

bbss17:05:26

Which the .coerce namespace depends on, which is weird because when I used the function before I restarted it worked.

bbss17:05:05

It's really the only kitten that sometimes needs to claw itself to fresh air once in a while.

bbss17:05:44

(metaphor for the only thing that sometimes gets to me with cljx)

ghadi18:05:28

you're using cljx?

bbss18:05:10

@ghadi is that not short for clojure(script) ?

bbss18:05:35

Oh right, it's the pre-conditional reader library

ghadi18:05:38

there was an earlier library called cljx that did something similar to cljc

bbss18:05:40

sorry, it's cljc

bbss18:05:27

I meant to say, the only thing that I find really annoying at times is dependency issues like these. It takes by far the most of my time out of all time-taking things that aren't normal debugging/coding.

bbss18:05:27

lein clean and lein deps solved it

bbss18:05:51

thanks for saving my kittens 🙂

seancorfield22:05:37

For folks doing programmatic decoding of explain-data to produce nice messages, it seems that required keys now (in 0.1.123) produce a :pred of (clojure.core/fn [%] (contains? % :the-key)) whereas they used to produce (contains? % :the-key) — this broke a lot of our decoding logic so I figured I’d mention it here in case it helps other debug similar breakage…

arohner22:05:28

given an (s/keys :opt-un [::foo]), what is the best way to generate a map with foo always in it? I occasionally see test failures in CI Couldn't satisfy such-that predicate after 10 tries, when I do (gen/such-that :foo (s/gen ::the-map))