This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-06-08
Channels
- # babashka (9)
- # beginners (43)
- # biff (4)
- # calva (11)
- # cider (6)
- # clerk (1)
- # clj-kondo (4)
- # cljs-dev (6)
- # clojure (82)
- # clojure-berlin (1)
- # clojure-europe (42)
- # clojure-nl (1)
- # clojure-norway (182)
- # clojure-quebec (1)
- # clojure-uk (19)
- # clojurescript (6)
- # datahike (1)
- # emacs (30)
- # fulcro (5)
- # honeysql (6)
- # hyperfiddle (12)
- # lambdaisland (8)
- # malli (11)
- # off-topic (36)
- # pathom (26)
- # pedestal (1)
- # portal (25)
- # practicalli (1)
- # rdf (29)
- # re-frame (17)
- # reitit (1)
- # releases (1)
- # sci (37)
- # shadow-cljs (15)
- # vim (10)
- # xtdb (13)
When using providers, is there a way to infer that a string valued property is an enum?
Judging by the source code, I don't see any way other than
(mp/provide
[(mp/-hinted "a" :enum)
(mp/-hinted "b" :enum)])
=> [:enum "a" "b"]
Ah, hinting just the first value works as well:
(mp/provide
[(mp/-hinted "a" :enum)
"b" "c" "d"])
=> [:enum "a" "b" "c" "d"]
Thanks. My case is more like digging in to a map. So given something like:
[{:data {:stage "foo"}}
{:data {:stage "bar"}}
...]
I'd like to infer [:map [:data [:map [:stage [:enum "foo" "bar"]]]]]
.So maybe the correct question is how to hint a specific property.
(mp/provide
[{:data {:stage (mp/-hinted "foo" :enum)}}
{:data {:stage "bar"}}])
=> [:map [:data [:map [:stage [:enum "foo" "bar"]]]]]
👀 2
When my [:fn pred]
pred function throws some exception I only get an empty message
how do I get the actual exception
No built-in way.
But if that exception has :type
in its ex-data
, that will become a part of the reported error.
Unfortunately it doesn’t, the exception was :
Execution error (IllegalArgumentException) at tick.protocols/eval11136$fn$G (protocols.cljc:88).
No implementation of method: :date of protocol: #'tick.protocols/IExtraction found for class: nil
so what I got was almost like a silent failure