Refinements

com.softinio.verdict4s.algebra.Refinements
object Refinements

Refined primitives shared across the protocol.

Each of these is an Iron io.github.iltotore.iron.RefinedType, so the bound the TypeSafe API documents is carried by the type itself rather than re-checked at each use site. Literals are folded at compile time:

val p = Probability(0.95) // ok
val q = Probability(1.5) // rejected at compile time

Values arriving from JSON are not literals, so decoders use Probability.either, turning an out-of-range number from the service into a typed decoding failure instead of letting it propagate.

RefinedType produces a nominal type: unwrap it with .value. That is deliberate — the alternative, a bare Double :| C alias, is a true Double subtype but prints its whole constraint in signatures and would let Probability and Confidence be passed interchangeably.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
In this article