3 ms·
I don't have nearly the breadth of experience in Clojure as the circleci guys, but I found that Prismatic's Schema [0] works well for me vs. core.typed. I can s
by numlocked 11y ago
I don't have nearly the breadth of experience in Clojure as the circleci guys, but I found that Prismatic's Schema [0] works well for me vs. core.typed. I can selectively annotate functions with their return types, and test runs will validate that they are returning as expected. It's runtime evaluated, so you lose a lot of static analysis benefits that type checking gives you, but it still provides some good code coverage, forces you to think about types a bit, and (the biggest benefit for me) it serves as documentation for functions that might return somewhat complex types. I can return to code months later and have a good idea of what's going on.
I've found the syntax a little arcane, particularly for coercion (which is a secondary function of Schema) but the documentation benefits have been worth the effort of learning it.
A nice middle ground between nothing, and full-blown type annotations.
[0] https://github.com/Prismatic/schema https://github.com/Prismatic/schema