I am updating my input validation library to better handle cases where you want to run validation “onBlur” and not “onInput”, in response to this issue: https://github.com/ericgj/elm-validation/issues/3
Essentially, it means adding a state called Unvalidated String – when input is happening but you haven’t yet run validation on it.
The question arose whether then we need an Initial (empty) state, since Initial could be modelled as Unvalidated "".
My view is it may be useful to distinguish cases where a user starts entering and then deletes their input, versus a truly unedited initial state. (Also, given the structure is monadic it seems odd not to have a true empty state, although I guess I could rewrite initial = Unvalidated "".)
But, it was objected that this would force users to handle two states that in most cases are for practical purposes the same. The data structure is not opaque so potentially people would be caseing on it. (Although I think I give enough basic functions you really shouldn’t need to, IMO.)
Anyway, long story short, if anyone else uses this library now or would like to use it, let me know what you think, either here or on the github issue.
I’ve added a branch which has distinct Initial and Unvalidated String states, and an example if you are curious what it would look like.