Welcome to my PinkLetter. A short, weekly, technology-agnostic, and pink newsletter where we cultivate timeless skills about web development.
How do you make people grok type-thinking or type-driven-development?
I’m obsessed with that question because I want to help the TypeScript community.
I know because It’s what I do with Polish: I think in English first and translate literally to Polish later. My sentences come out awkward and I’m not as fluid as in English where I speak what I think.
What I do with types is to keep massaging them until I have a viable model with the lowest cardinality possible.
Let’s say you are coding an HTTP request and throw
isErrored at your model. Two booleans give you a cardinality of four (i.e., true/true, false/false, true/false, false/true) but do they all make sense? I’m pretty sure
isErrored=true is an invalid state and it’d be better to use a type that has a cardinality of three.
With the types in place, I move to see how ergonomic and correct the model is when thrown at the problem.
Do you think that’s a good approach?
Make Bugs Impossible. One TypeScript Tip At A Time.
(Riccardo: Shameless plug.)
In this talk, I’ll share a methodology that I have applied many times over the last 20+ years when designing high-level libraries for functional programming. Functional libraries are usually organized around small collections of domain-specific data types together with operations for forming and combining values of those types. When done well, the result has the elegance and precision of algebra on numbers while capturing much larger and more interesting ideas.
(Riccardo: Watched it multiple times and each time I feel I’m getting closer to a big revelation.)
Richard talks with Unison Programming Language co-creator Rúnar Bjarnason about the things that make Unison unlike any other programming language in the world.
(Riccardo: Sounds cool. Here’s the Big Idea page from the Unison docs.)