Skip to content

Instantly share code, notes, and snippets.

@adamw
Last active March 31, 2022 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamw/9b17d25520f33be8278152332bfad39f to your computer and use it in GitHub Desktop.
Save adamw/9b17d25520f33be8278152332bfad39f to your computer and use it in GitHub Desktop.
opaque type NonEmptyString = String
object NonEmptyString:
def apply(s: String): Option[NonEmptyString] =
if s.isEmpty then None else Some(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment