core-typed

2023-10-16T00:34:50.778739Z

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
Corneliu Hoffman 2023-10-16T11:46:22.396379Z

yes please :))

2023-10-16T16:38:23.515369Z

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

2023-10-16T16:38:37.518399Z

that's the hardest one I think.

2023-10-16T16:43:56.653629Z

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

2023-10-16T16:44:51.863729Z

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