I take it you didn’t read the whole thing, as the next example is NonEmptyList, which is a good compelling example. It’s also not hard to think of other examples from my own work: I can imagine a URL type that only exposes constructors to create well-formed URLs. Etc etc.
Really good examples will be rather domain-specific, so it’s perfectly understandable why Alexis would trust her readers to be able to imagine uses that suit their needs.
Re:Names are not type safety (2020)
by auggierose on Monday August 04, 2025 @04:18AM
(#44783205)
Yes, I didn't, and I don't think NonEmptyList should have its own type either. This is just busy work and not a good example either.
It's just an example! Well, if you cannot come up with a good example, maybe you don't have a point.