Join the discussion
Write your take first — we'll ask for email only when you're ready to publish.
- Hacker News
- Language is not mentioned in a title, so my first thought was about TypeScript type wizardry. Turns out it's as simple as `Exclude<string, "">`.
https://www.typescriptlang.org/docs/handbook/utility-types.h...
Edit: nevermind, LLM fooled me.
by ivanjermakov - Empty strings are usually an artifact of lazy developers paying a minimal "empty" value for a type (just as 0 for numbers).
A type like NonEmptyString is a weak defense against that, as a lazy dev can just pass a single space character or something similar.
by VMG - Very cool that the language allows specification of a type in this way.
I added a similar type — “non-empty-string” to a typechecker for PHP, and it’s been adopted widely in the PHP ecosystem. It turns out to be pretty handy, especially when there’s a full type system to support it.
by muglug - "Huh never heard of Bellroy... I wonder what they're using Haskell for..."
Turns out it's some kind of bags and accessories brand!
by IshKebab