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

Add a Testable instance for Either #92

Open
Rembane opened this issue May 16, 2018 · 2 comments
Open

Add a Testable instance for Either #92

Rembane opened this issue May 16, 2018 · 2 comments
Labels
type: enhancement A new feature or addition.

Comments

@Rembane
Copy link

Rembane commented May 16, 2018

Result is not a very composable data type, which makes it clunky to work with. If we add a Testable instance for Either String Unit we can use the whole machinery around the Either type and make testing a much more pleasant experience.

Contrived example of pleasant experience:

p :: Array String -> Either String Unit
p  a = do
  i <- note "Couldn't find hello." (elemIndex "hello" a)
  if mod i 2 > 0 
    then Left "hello isn't on an index divisible by two."
    else Right unit

In my opinion this experience becomes pleasant because I can use do-notation, note and a load of other niceties.

If you think this is a good idea I can implement the instance(s) needed and make a PR.

@garyb
Copy link
Member

garyb commented Jun 5, 2018

Seems reasonable to me!

@Rembane
Copy link
Author

Rembane commented Jun 5, 2018

Then I'll start hacking and get back with a PR in a few weeks.

@JordanMartinez JordanMartinez added the type: enhancement A new feature or addition. label Dec 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A new feature or addition.
Projects
None yet
Development

No branches or pull requests

3 participants