Bond - Type-level validation for Scala

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Bond - Type-level validation for Scala

Flávio Brasil-2

I’ve just pushed to maven central the first release of Bond. It is a library to express validation constraints using the type system. Some usage examples:


case class Employee (
    name: String with NonEmpty,
    email: String with Email,
    age: Int with GreaterThan[T.`14`.T]

case class Company (
    employees: List[Employee] with MinSize[T.`2`.T]

val employeeAge: Int with GreaterThan[T.`14`.T] = ...

val lifted: Int with GreaterThan[T.`12`.T] =


[error] The lifting of 'Int with[Int(14)]'' to '[Int(18)]' is not valid (Bond)
[error]         GreaterThan(18).lift(employee.age)
[error]                             ^


Flavio W. Brasil

You received this message because you are subscribed to the Google Groups "scala-announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit