sift/int
Integer validators — range, positivity, and membership checks.
Values
pub fn between(
lo: Int,
hi: Int,
msg: String,
) -> fn(Int) -> Result(Int, String)
Value must be between lo and hi (inclusive).
let validator = int.between(1, 100, "out of range")
validator(50) // -> Ok(50)
validator(200) // -> Error("out of range")
pub fn non_negative(
msg: String,
) -> fn(Int) -> Result(Int, String)
Value must be >= 0
pub fn one_of(
values: List(Int),
msg: String,
) -> fn(Int) -> Result(Int, String)
Value must be one of the given values