Neotype as a better solution than Scala 3 opaque types

As I mentioned previously, the Neotype library is a nice improvement over the verbose Scala 3 opaque type feature. This little example begins to show how much better Neotype is than opaque types, where opaque types require more boilerplate to implement less functionality:

//> using scala "3"
//> using lib "io.github.kitlangton::neotype::0.3.0"

import neotype.*

// [1] Opaque type:
opaque type Username = String
object Username:
    def apply(value: String): Username = value

// [2] Neotype:
object Password extends Newtype[String]:
    override inline def validate(input: String): Boolean =
        input.nonEmpty && input.length > 2

@main def NeotypeTests =

    val u = Username("Alvin")
    val p = Password("12")

Note that this specific example results in this compile-time error, as desired:

[error]   —— Neotype Error ——————————————————————————————————————————————————————————
[error]   Password was called with an INVALID String.  
[error]   input: "12"
[error]   check: input.nonEmpty && input.length > 2
[error]   ———————————————————————————————————————————————————————————————————————————
[error]     val p = Password("12")
[error]             ^^^^^^^^^^^^^^

Neotype is a great improvement over opaque types, and it shows more features than what I have shown here.