Skip to content

Make fromLeft/fromRight total functions by providing default values #48

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
Oct 15, 2020
Merged

Make fromLeft/fromRight total functions by providing default values #48

merged 2 commits into from
Oct 15, 2020

Conversation

JordanMartinez
Copy link
Contributor

Fixes #47

@JordanMartinez
Copy link
Contributor Author

Had to force push this because I didn't implement fromRight correctly due to putting the Right b pattern match after the left's _ pattern match

@garyb garyb added the type: breaking change A change that requires a major version bump. label Feb 17, 2019
@hdgarrood
Copy link
Contributor

I don't think it will be totally clear what the "default value" is when these documentation comments are rendered on Pursuit and the definition isn't visible. How about this instead?

A function that extracts the value from the Left data constructor. The first argument is a default value, which will be returned in the case where a Right is passed to fromLeft.

@JordanMartinez
Copy link
Contributor Author

Yeah, that reads better. I've updated the docs to include that.

@srghma
Copy link
Contributor

srghma commented May 8, 2020

what if we leave old partial functions, but rename them to unsafeFromLeft and unsafeFromRight?

@JordanMartinez
Copy link
Contributor Author

what if we leave old partial functions, but rename them to unsafeFromLeft and unsafeFromRight?

I think keeping them makes sense.

@garyb
Copy link
Member

garyb commented May 9, 2020

I dunno, you can just do fromLeft crash with this version 🙂

@JordanMartinez JordanMartinez merged commit 9090158 into purescript:master Oct 15, 2020
@JordanMartinez JordanMartinez deleted the updateFromLR branch October 15, 2020 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: breaking change A change that requires a major version bump.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fromLeft / fromRight shouldn't be partial
4 participants