Skip to content

Fix either #11

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

Merged
merged 2 commits into from
Jan 15, 2016
Merged

Fix either #11

merged 2 commits into from
Jan 15, 2016

Conversation

hdgarrood
Copy link
Contributor

Currently, the instances for Either don't record which constructor was used, which means that you get the wrong result if the two types have compatible encodings (for example, Either String String, or Either Number Int).

@garyb garyb closed this Jan 13, 2016
@garyb garyb reopened this Jan 13, 2016
@garyb
Copy link
Member

garyb commented Jan 13, 2016

I noticed this was a little suspect when I revised the Maybe instance a little while ago. I prefer this version as it avoids Alt for branching too, and is explicit about the expected structure, so 👍

@garyb
Copy link
Member

garyb commented Jan 13, 2016

Perhaps encoding as an object would be better still?

@hdgarrood
Copy link
Contributor Author

So like Left 3 -> {"Left": 3}?

@garyb
Copy link
Member

garyb commented Jan 13, 2016

Yeah, something like that. Looks like the tests failed for the other one too?

@hdgarrood
Copy link
Contributor Author

Yeah, I see what the problem is. Oops :) one sec.

@hdgarrood
Copy link
Contributor Author

Ok, how about this?

@garyb
Copy link
Member

garyb commented Jan 15, 2016

Looks great 👍, sorry about the delay.

garyb added a commit that referenced this pull request Jan 15, 2016
@garyb garyb merged commit 20a0343 into purescript-contrib:master Jan 15, 2016
@hdgarrood hdgarrood deleted the fix-either branch January 15, 2016 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants