Just in case someone stumbles over this post, I found a simple solution
which works for me:
(do
(require '[clojure.spec.alpha :as s])
(import '(clojure.lang ISeq))
(defprotocol Foo (foo [this]))
(defrecord Bar [bar] Foo (foo [this] (.bar this)))
(deftype Baz [bar]
Foo (foo [this]
on behalf of
markus.ag...@gmail.com
Sent: Wednesday, July 4, 2018 7:47:45 AM
To: Clojure
Subject: Re: How do I use spec and deftype together?
So is it best practice to implement map in the deftype to make it spec-able?
Are there examples somewhere that show how to do this in a canonical way?
On W
So is it best practice to implement map in the deftype to make it
spec-able? Are there examples somewhere that show how to do this in a
canonical way?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googl
So is it best practice to implement map in the deftype to make it
spec-able? Are there examples somewhere that show how to do this in a
canonical way?
On Wednesday, July 4, 2018 at 12:51:29 PM UTC+2, Leon Grapenthin wrote:
>
> Spec doesn't check object fields. The defrecord case works because
>
Spec doesn't check object fields. The defrecord case works because
defrecord implements map.
On Wednesday, July 4, 2018 at 12:47:26 PM UTC+2, markus...@gmail.com wrote:
>
> The same question was asked on
> https://clojurians-log.clojureverse.org/clojure-spec/2018-01-19
> but I did not find an ans