`ifNotFloat` has different behavior than `ifNotInt`
jaredramirez opened this issue · 0 comments
jaredramirez commented
The function ifNotFloat
will error if the subject
is a float, whereas ifNotInt
will error if the subject is not an int. I believe the behavior of ifNotInt
is correct. In the definition of isNotFloat
, ifTrue
, should be ifFalse
.
The current definition:
ifNotFloat : (subject -> String) -> error -> Validator error subject
ifNotFloat subjectToString error =
ifTrue (\subject -> isFloat (subjectToString subject)) error
The correct definition:
ifNotFloat : (subject -> String) -> error -> Validator error subject
ifNotFloat subjectToString error =
ifFalse (\subject -> isFloat (subjectToString subject)) error
Note:
The definition of ifNotFloat
and ifNotInt
also differ in the second argument as well. ifNotInt
takes a function with the invalid int, whereas ifNotFloat
takes just the error. Any changes to ifNotFloat
should probably also reconcile the definitions to be the same.