expound

Alex Whitt 2019-05-03T01:52:47.001300Z

Hi! Is there a way to omit clojure.spec.alpha/problems from printing in the REPL? After Detected x Errors, my REPL vomits forth the contents of :clojure.spec.alpha/problems. From what I could tell looking at your code, I don't think expound is the one doing this. Regardless, I need to omit that, as it's redundant, unreadable, and can get oppressively long. (The part expound prints beforehand is doing its job very nicely, however!)

bbrinck 2019-05-03T01:57:03.002800Z

Hi @alex.joseph.whitt! What version of Clojure are you using in your REPL?

bbrinck 2019-05-03T01:58:09.003900Z

If memory serves, I think this behavior is configured by the Clojure REPL itself. I think it can be configured, but how to do so depends on your version, I think

Alex Whitt 2019-05-03T02:00:53.004700Z

;; CIDER 0.22.0snapshot (package: 20190419.1025), nREPL 0.6.0 ;; Clojure 1.9.0, Java 1.8.0_202

Alex Whitt 2019-05-03T02:01:23.005200Z

I don't mind upgrading if that helps. Thank you for the quick response!

bbrinck 2019-05-03T02:01:38.005800Z

Cool, one sec

bbrinck 2019-05-03T02:03:47.006600Z

I think that upgrading to Clojure 1.10 may just fix if you want to give that a shot. Hopefully that won’t cause any other issue for you 🤞

bbrinck 2019-05-03T02:06:37.007100Z

are you using the REPL in cider or in the console?

bbrinck 2019-05-03T02:12:08.007800Z

@alex.joseph.whitt I see the behavior you describe in clojure 1.9.0

clj -Sdeps '{:deps {org.clojure/core.specs.alpha {:mvn/version "0.2.44"} speculative {:mvn/version "0.0.3"} expound {:mvn/version "0.7.2"} org.clojure/
test.check {:mvn/version "0.9.0"} org.clojure/clojure {:mvn/version "1.9.0"}}}'
Clojure 1.9.0
user=> (require '[clojure.spec.test.alpha :as st] '[clojure.spec.alpha :as s] '[expound.alpha :as expound])
nil
user=> (set! s/*explain-out* expound/printer)
#object[expound.alpha$printer 0x70807224 "expound.alpha$printer@70807224"]
user=> (st/instrument)
[expound.printer/indent expound.paths/prefix-path? expound.alpha/explain-result-str expound.alpha/specs expound.alpha/explain-results expound.alpha/error-message expound.alpha/cu
stom-printer expound.paths/kvps-path? expound.alpha/explain-results-str expound.alpha/value-in-context expound.printer/pprint-str expound.alpha/expound expound.alpha/defmsg expou
nd.alpha/expound-str expound.paths/kps-path? expound.alpha/printer expound.alpha/explain-result expound.problems/summary-form expound.printer/no-trailing-whitespace]
user=> (defn)

👍 1
bbrinck 2019-05-03T02:13:04.008100Z

but not with 1.10.0

clj -Sdeps '{:deps {org.clojure/core.specs.alpha {:mvn/version "0.2.44"} speculative {:mvn/version "0.0.3"} expound {:mvn/version "0.7.2"} org.clojure/
test.check {:mvn/version "0.9.0"} org.clojure/clojure {:mvn/version "1.10.0"}}}'
Clojure 1.10.0
user=> (require '[clojure.spec.test.alpha :as st] '[clojure.spec.alpha :as s] '[expound.alpha :as expound])
nil
user=> (set! s/*explain-out* expound/printer)
#object[expound.alpha$printer 0x63429932 "expound.alpha$printer@63429932"]
user=> (st/instrument)
[expound.printer/indent expound.paths/prefix-path? expound.alpha/explain-result-str expound.alpha/specs expound.alpha/explain-results expound.alpha/error-message expound.alpha/cu
stom-printer expound.paths/kvps-path? expound.alpha/explain-results-str expound.alpha/value-in-context expound.printer/pprint-str expound.alpha/expound expound.alpha/defmsg expou
nd.alpha/expound-str expound.paths/kps-path? expound.alpha/printer expound.alpha/explain-result expound.problems/summary-form expound.printer/no-trailing-whitespace]
user=> (defn)

👍 1
bbrinck 2019-05-03T02:13:59.009100Z

but the complexity here is that this is just in the clj REPL which implements a specific handler for errors. leiningen and nrepl may have different behaviors by default, since they don’t use the same error handler by default as clj

bbrinck 2019-05-03T02:16:26.011300Z

sorry, i realize that’s a complex answer for a simple question, but unfortunately, error handling in REPLs is complicated by the array of tools we have. You can try the following: 1. Upgrade to Clojure 1.10.0 2. If you’re using lein, consider upgrading that 3. See if you can get the correct behavior on the console REPL (either clj or lein repl) 4. If that works correctly, see if you can get the correct behavior in a CIDER REPL Hope that helps!

👍 1
Alex Whitt 2019-05-03T14:44:50.011900Z

The update was a bit painful but it fixed the issue! Thank you so much for looking into this.

👍 1