
urldsl.vocabulary.FromStringWithNumeric.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of url-dsl_3 Show documentation
Show all versions of url-dsl_3 Show documentation
A tiny library for parsing and creating urls in a type-safe way
The newest version!
package urldsl.vocabulary
import urldsl.errors.ErrorFromThrowable
trait FromStringWithNumeric {
implicit def numericFromString[T, A](implicit
num: Numeric[T],
fromThrowable: ErrorFromThrowable[A]
): FromString[T, A] = FromString.factory(s =>
num.parseString(s) match {
case Some(t) => Right(t)
case None => Left(fromThrowable.fromThrowable(new Exception(s"$s is not numeric")))
}
)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy