A validation library for gleam!
Validators are functions which check the properties of data and raise generic issues.
fn bounded(
validator: Validator(x, Int, i),
between min: Int,
and max: Int,
raise issue: i,
) -> Validator(x, Int, i) {
use int <- extend(validator)
case min < int && int < max {
True -> valid(int)
False -> invalid(int, issue)
}
}
This package has not yet been published to Hex (but it will be as soon as I figure out how to do that).