Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.typed by
Currently {{select-keys}} on an {{HMap}} returns a {{Map}} with unions for keys and values.


=> (t/cf {:foo 1, :bar "2", :baz \3})
[(HMap :mandatory {:baz (Value \3), :bar (Value "2"), :foo (Value 1)} :complete? true) {:then tt, :else ff}]

=> (t/cf (select-keys {:foo 1, :bar "2", :baz \3}
                      [:foo :bar]))
(t/Map (U (Value :baz) (Value :foo) (Value :bar)) (U (Value 1) (Value \3) (Value "2")))


This results in type errors when {{select-keys}} is used to remove extra keys from an {{HMap}}.

Expected behaviour: {{select-keys}} should return an {{HMap}} with a subset of the {{:mandatory}} keys of its input {{HMap}}.

1 Answer

0 votes
by
Reference: https://clojure.atlassian.net/browse/CTYP-129 (reported by noidi)
...