I've used glint quite a bit and I just used a flag constraint for the first time.
I was hoping id be able to do something like this:
use url <- glint.flag(
glint.string_flag("url")
|> glint.flag_constraint(fn(url) {
case uri.parse(url) {
Error(_) -> snag.error("Invalid url")
Ok(url) -> Ok(url)
}
}),
)
But I don't think this is available at the moment.
It would, however, be quite nice I think. As I currently have to either handle the impossible parse error later on or assert it. Both of which are less than optimal IMO.
I've used glint quite a bit and I just used a flag constraint for the first time.
I was hoping id be able to do something like this:
But I don't think this is available at the moment.
It would, however, be quite nice I think. As I currently have to either handle the impossible parse error later on or assert it. Both of which are less than optimal IMO.