You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be really useful if the validate and ensure used (a -> Maybe b) instead of (a -> Bool). This would allow the user to output an updated, validated value as a result.
For example, my current use case is that I'm validating an Integer to a Natural, ensuring that the Integer is (n >= 0).
So I could do:
positive::Integer->ValidationErrorsNatural
positive n =
validate (pure$NegativeVal n) (if n <=thenJust$fromInteger n elseNothing) n
What do you think? :)
The text was updated successfully, but these errors were encountered:
It would be really useful if the
validate
andensure
used(a -> Maybe b)
instead of(a -> Bool)
. This would allow the user to output an updated, validated value as a result.For example, my current use case is that I'm validating an
Integer
to aNatural
, ensuring that theInteger
is(n >= 0)
.So I could do:
What do you think? :)
The text was updated successfully, but these errors were encountered: