Clojurians
#expound
<
2019-05-03
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

alex.joseph.whitt01:05:47

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!)

bbrinck01:05:03

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

bbrinck01:05:09

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.joseph.whitt02:05:53

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

alex.joseph.whitt02:05:23

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

bbrinck02:05:38

Cool, one sec

bbrinck02:05:47

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 :crossed_fingers:

bbrinck02:05:37

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

bbrinck02:05:08

@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 "[email protected]"]
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)

bbrinck02:05:04

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 "[email protected]"]
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)

bbrinck02:05:59

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

bbrinck02:05:26

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!

alex.joseph.whitt14:05:50

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