Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/causal/base/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -419,17 +419,16 @@
(deftype CausalBase [cb]
IPrintWithWriter
(-pr-writer [o writer opts]
(-write writer (str "#causal/base " (pr-str (s/causal->edn o)))))))
(-write writer (str "#causal/base " (pr-str cb))))))

#? (:clj (defmethod print-method CausalBase [^CausalBase o ^java.io.Writer w]
(.write w (str "#causal/base " (pr-str (s/causal->edn o))))))
(.write w (str "#causal/base " (pr-str (.-cb o))))))

(defn read-edn-map
[read-object]
(let [[cb] read-object]
(CausalBase. cb)))
(defn read-edn
[cb]
(CausalBase. cb))

#? (:cljs (cljs.reader/register-tag-parser! 'causal.collections.list read-edn-map))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smothers This seemed like an error, so I replaced it with a 'causal/base tag parser. Will this break anything?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is indeed a bug. Good catch. This code was never tested so it shouldn’t break anything important. Everything important should have tests.

#? (:cljs (cljs.reader/register-tag-parser! 'causal/base read-edn))

(extend-type CausalBase
proto/CausalBase
Expand Down
17 changes: 6 additions & 11 deletions src/causal/collections/list.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@

IPrintWithWriter
(-pr-writer [o writer opts]
(-write writer (str "#causal/list " (pr-str (s/causal->edn o)))))
; (-write writer (str "#causal/list " (pr-str {:causal->edn (s/causal->edn o)
; :ct (.-ct o)}))))
(-write writer (str "#causal/list " (pr-str (.-ct o)))))

IHash
(-hash [this] (-hash (.-ct this)))
Expand All @@ -135,16 +133,13 @@
(-with-meta [this meta] (CausalList. (-with-meta (.-ct this) meta)))))

#? (:clj (defmethod print-method CausalList [^CausalList o ^java.io.Writer w]
(.write w (str "#causal/list " (pr-str (s/causal->edn o))))))
; (.write w (str "#causal/list " (pr-str {:causal->edn (s/causal->edn o)
; :ct (.ct o)})))))
(.write w (str "#causal/list " (pr-str (.-ct o))))))

(defn read-edn-map
[read-object]
(let [[ct] read-object]
(CausalList. ct)))
(defn read-edn
[ct]
(CausalList. ct))

#? (:cljs (cljs.reader/register-tag-parser! 'causal/list read-edn-map))
#? (:cljs (cljs.reader/register-tag-parser! 'causal/list read-edn))

(extend-type CausalList
proto/CausalMeta
Expand Down
17 changes: 6 additions & 11 deletions src/causal/collections/map.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,7 @@

IPrintWithWriter
(-pr-writer [o writer opts]
(-write writer (str "#causal/map " (pr-str (s/causal->edn o)))))
; (-write writer (str "#causal/map " (pr-str {:causal->edn (s/causal->edn o)
; :ct (.-ct o)}))))
(-write writer (str "#causal/map " (pr-str (.-ct o)))))

IHash
(-hash [this] (-hash (.-ct this)))
Expand All @@ -216,16 +214,13 @@
(-with-meta [this meta] (CausalMap. (-with-meta (.-ct this) meta)))))

#? (:clj (defmethod print-method CausalMap [^CausalMap o ^java.io.Writer w]
(.write w (str "#causal/map " (pr-str (s/causal->edn o))))))
; (.write w (str "#causal/map " (pr-str {:causal->edn (s/causal->edn o)
; :ct (.ct o)})))
(.write w (str "#causal/map " (pr-str (.-ct o))))))

(defn read-edn-map
[read-object]
(let [[ct] read-object]
(CausalMap. ct)))
(defn read-edn
[ct]
(CausalMap. ct))

#? (:cljs (cljs.reader/register-tag-parser! 'causal/map read-edn-map))
#? (:cljs (cljs.reader/register-tag-parser! 'causal/map read-edn))

(extend-type CausalMap
proto/CausalMeta
Expand Down
3 changes: 3 additions & 0 deletions src/data_readers.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{causal/base causal.base.core/read-edn
causal/list causal.collections.list/read-edn
causal/map causal.collections.map/read-edn}