Open Collective
Open Collective
Loading
Typed Clojure 1.0.32: Merge at type level
Published on September 17, 2022 by Ambrose Bonnaire-Sergeant

Hi,

Happy to announce Typed Clojure 1.0.32. It has a new type `t/Merge` that can merge HMap's. It's similar to spec's `s/merge` and malli's `:merge` in spirit, except it's literally `clojure.core/merge`'s type checking rules but lifted to types.

(t/Merge) => nil

(t/Merge '{:a 1}) => '{:a 1}

(t/Merge '{:a t/Int} '{:b t/Int}) => '{:a t/Int :b t/Int}

(t/Merge '{:a t/Int} '{:a t/Bool}) => '{:a t/Bool}

Thanks to Francesco Arena for suggesting it in #core-typed Slack.

Ambrose