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

Does it make sense to provide isSuccess and isFailure functions? #28

Open
dnadales opened this issue Sep 17, 2018 · 2 comments
Open

Does it make sense to provide isSuccess and isFailure functions? #28

dnadales opened this issue Sep 17, 2018 · 2 comments

Comments

@dnadales
Copy link

It'd be nice to have functions

isSuccess, isFailure :: Validate v => v -> Bool

Does this make sense? If so I can submit a PR.

@tonymorris
Copy link
Contributor

You could, but they would be as simple as:

import Control.Lens.Extra(is)
isSuccess = is _Success
isFailure = is _Failure

If you think they are useful, then let's do it! Thanks.

@dnadales
Copy link
Author

Oh, I was not aware of the is function. Very nice!

If this information could be included in the documentation I guess we don't need isFailure and isSuccess unless depending on lenses is not an option. But since validation already depends on lens I guess this shouldn't be an issue for the library users.

So I'm in favor of not having these functions :)

Does it make sense to document how _Success and _Failure could be used in combination with is? Or it is expected that any lens-educated person (which excludes me :D ) should know this?

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

2 participants