Size, MaxSize and MinSize for String?
mlopes opened this issue · 4 comments
Would it make sense to have refinment types that constrain String sizes? I frequently see APIs that have arbitrary size constraints on Strings, and using a String type to represent that while missing the constraints seems dissonant.
I can give it a try to see if I can implement that, if that's something that makes sense?
This is already supported. Try for example String Refined MaxSize[5]
or String Refined Size[Equal[5]]
.
Ah sorry, I saw in the documentation that those where for Collections and thought they weren't available for strings. :)
No problem. Maybe we should improve the documentation then. Most of the collection predicates also work for strings. Any suggestion where we should mention that strings are supported too, are welcome!
Maybe somewhere around here?
https://github.com/fthomas/refined/blame/master/README.md#L399
Won't be able to make a PR in the next week or so, but I can try to do it later/