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

fromEither :: b -> Either a b -> b #130

Closed
davidchambers opened this issue Jan 15, 2016 · 1 comment
Closed

fromEither :: b -> Either a b -> b #130

davidchambers opened this issue Jan 15, 2016 · 1 comment

Comments

@davidchambers
Copy link
Member

This was suggested by @Bpless as a way to extract the b from a value of type Either a b. It's analogous to fromMaybe :: a -> Maybe a -> a.

Usage:

> S.fromEither(NaN, S.Left('XXX'))
NaN

> S.fromEither(NaN, S.Right(42))
42
@svozza
Copy link
Member

svozza commented Jan 15, 2016

Oh nice, I'd really like this function.

wennergr added a commit to wennergr/sanctuary that referenced this issue Jun 7, 2016
S.fromEither :: b -> Either a b -> b

Closes: sanctuary-js#130
wennergr added a commit to wennergr/sanctuary that referenced this issue Jun 7, 2016
S.fromEither :: b -> Either a b -> b

Closes: sanctuary-js#130
wennergr added a commit to wennergr/sanctuary that referenced this issue Jun 7, 2016
S.fromEither :: b -> Either a b -> b

Closes: sanctuary-js#130
wennergr added a commit to wennergr/sanctuary that referenced this issue Jun 7, 2016
S.fromEither :: b -> Either a b -> b

Closes: sanctuary-js#130
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants