Fancy strings in Scala 3

PHOTO EMBED

Mon Apr 25 2022 20:06:42 GMT+0000 (UTC)

Saved by @joel113 #scala

opaque type LowerCased = String

object LowerCased:
  def apply(s: String): LowerCased = s.toLowerCase(Locale.US)

  given Conversion[LowerCased, String] with
    inline def apply(lc: LowerCased): String = lc
content_copyCOPY

https://softwaremill.com/fancy-strings-in-scala-3/