Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ifNotFloat has different behavior than ifNotInt #43

Open
jaredramirez opened this issue Feb 24, 2020 · 0 comments
Open

ifNotFloat has different behavior than ifNotInt #43

jaredramirez opened this issue Feb 24, 2020 · 0 comments

Comments

@jaredramirez
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant