Hello, I ran into another issue that I don’t completely understand.
I have a record that looks like this.
(defrecord TxDataPart
[tx-data id-mappings])
(t/ann-record TxDataPart [tx-data :- t/Any id-mappings :- IdMappings])I then want to type a function for combining tx-data-parts.
(defn combine-tx-data
[& tx-data-seqs]
(tx-data
(vec (mapcat :id-mappings tx-data-seqs))
(vec (mapcat :tx-data tx-data-seqs))))
(t/ann combine-tx-data [TxDataPart :* :-> TxDataPart])And I am getting a type error that looks like this
Type Error (file:/Users/ivan.willig/dev/databog/src/databog/main.clj:62:10)
Polymorphic function mapcat could not be applied to arguments:
Polymorphic Variables:
c
a
b :..
Domains:
[a b :.. b :-> (t/Seqable c)] (t/Seqable a) (t/Seqable b) :.. b
Arguments:
(t/Val :tx-data) (t/U nil (t/I (t/HSeq [TxDataPart *]) (t/CountRange 1)))
Ranges:
(t/ASeq c)
in:
(mapcat :tx-data tx-data-seqs)Its not clear to me where I went wrong.
is this happening because tx-data :- t/Any ?
Never mind, that was the issue
clojure I really like the way t/HMap and t/HVec work (plus their friends). That combined with defalias feels like a powerful way to describe your clojure programs.