core-typed 2023-10-16

Just learnt about dependent function types in Scala 3. This is what I want most of the core annotations to look like, so functions can work with both simple and complex (heterogenous) types without needing extra annotations https://docs.scala-lang.org/scala3/book/types-dependent-function.html This is the type I want to give clojure.core/seq:

(t/All [[x :< (t/Seqable t/Any)]]
       [x :-> (t/SeqOn x) :object {:id 0 :path [Seq]}])

👍 3
👍🏽 1

yes please :))

I'm gradually converting the clojure.lang.* collection hierarchy to use this style. Working on IPersistentCollection atm

that's the hardest one I think.

Now there's a single place that updates a type based on information learnt from its seq (e.g., (if (seq ..)) , and could potentially be overridden by different types. Not sure exactly the best way to expose the hook. https://github.com/typedclojure/typedclojure/commit/af48e0fc373eee3b89b7c668b605e695ed9fc126#diff-aa008535ece1158fc4f0364e0a66f127c806907ec87c83b976bb1dcc4839ea83R132-R139

Perhaps it can be automated, and no extension is necessary. that would be nice.