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

Why is the implementation of rights not extracting the values from right? #195

Closed
sovelten opened this issue Mar 30, 2017 · 4 comments
Closed

Comments

@sovelten
Copy link
Collaborator

In the implementation of rights from Haskell (https://hackage.haskell.org/package/base-4.9.1.0/docs/Data-Either.html), the right values are extracted from the either monad. Why is it not so in cats? The rights implementation from cats does not seem to be very useful if the values are not extracted.

@niwinz
Copy link
Member

niwinz commented Apr 20, 2017

I'm not clearly understand that you are trying to say. The either values can be extracted with deref or using the mlet macro.

@niwinz niwinz closed this as completed Apr 20, 2017
@sovelten
Copy link
Collaborator Author

If I have a list of eithers and I am selecting only the right values, it's because I'm interested in what they contain, there is no left value anymore, no need to keep the either abstraction. If I don't want to extract them, it's easy to write (filter right? mylist). Also, this is compatible to what the rights function does in Haskell.

@yurrriq
Copy link
Collaborator

yurrriq commented Apr 29, 2017

👍 to making rights mirror the one in Haskell, i.e. take a list of Eithers and return a list of the unwrapped Right values. Perhaps we could rename the current rights to keep-rights or similar.

@yurrriq
Copy link
Collaborator

yurrriq commented Apr 29, 2017

Also the current docstring (in master) has a typo and should s/left/right/ at least.

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

3 participants