Type-checked non-empty strings

(exploring-better-ways.bellroy.com)

35 points | by surprisetalk 3 days ago

4 comments

  • muglug 2 hours ago
    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.

  • IshKebab 2 hours ago
    "Huh never heard of Bellroy... I wonder what they're using Haskell for..."

    Turns out it's some kind of bags and accessories brand!

    • ambicapter 12 minutes ago
      I once saw a job ad for a company selling a horoscope app that required Haskell. An unusual conjunction for sure.
    • flexagoon 1 hour ago
      I've had a Bellroy bag, they're not the most fashionable but super high quality and well thought-out. Just like Haskell code—maybe that's why they like it.
    • qbane 2 hours ago
      I pondered for a while, it IS the company I used to know
  • ivanjermakov 2 hours ago
    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.

  • swordlucky666 2 hours ago
    [dead]