Fork me on GitHub
#core-typed
<
2023-08-23
>
ambrosebs15:08:01

Just merged a start at adding regex types, for now they are just syntactic sugar. Planning to hone in on the hard parts gradually.

[(t/alt (t/cat (t/? java.io.Reader))
        (t/cat java.io.Reader t/Bool)
        (t/cat java.io.Reader t/Bool t/Any (t/? t/Bool)))
 :-> t/Any]
;sugar for =>
(t/IFn [:-> t/Any]
       [java.io.Reader :-> t/Any]
       [java.io.Reader t/Bool :-> t/Any]
       [java.io.Reader t/Bool t/Any :-> t/Any]
       [java.io.Reader t/Bool t/Any t/Bool :-> t/Any])

❤️ 9
ambrosebs15:08:16

They make the "flat pairs" function types a little easier to read:

cc/hash-map (t/All [x y] [(t/cat x y) :* :-> (t/Map x y)])
cc/array-map (t/All [x y] [(t/cat x y) :* :-> (t/Map x y)])
cc/sorted-map (t/All [x y] [t/cat x y) :* :-> (t/Map x y)])
cc/sorted-map-by (t/All [x y] [[x x :-> t/Int] (t/cat x y) :* :-> (t/Map x y)])

ambrosebs15:08:55

Assuming that everyone who uses Clojure is fluent in some spec-like system.