
eu.timepit.refined.api.Refined.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of refined_sjs0.6_2.12.0-M4 Show documentation
Show all versions of refined_sjs0.6_2.12.0-M4 Show documentation
Simple refinement types for Scala
The newest version!
package eu.timepit.refined
package api
/**
* Wraps a value of type `T` that satisfies the predicate `P`. Instances of
* this class can be created with `[[refineV]]` and `[[refineMV]]` which
* verify that the wrapped value satisfies `P`.
*/
final case class Refined[T, P] private (get: T) extends AnyVal {
override def toString: String =
get.toString
}
object Refined {
/**
* Wraps `t` in `[[Refined]][T, P]` ''without'' verifying that it satisfies
* the predicate `P`. This method is for internal use only.
*/
def unsafeApply[T, P](t: T): Refined[T, P] =
new Refined(t)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy