Skip to content

cleaner nested eithers#8

Merged
paf31 merged 2 commits intopurescript:masterfrom
jdegoes:master
Mar 24, 2015
Merged

cleaner nested eithers#8
paf31 merged 2 commits intopurescript:masterfrom
jdegoes:master

Conversation

@jdegoes
Copy link
Copy Markdown
Contributor

@jdegoes jdegoes commented Mar 24, 2015

No description provided.

@jdegoes
Copy link
Copy Markdown
Contributor Author

jdegoes commented Mar 24, 2015

Same story, no libraries using this.

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 24, 2015

Looks good.

Curious: is this the way the nesting comes out of a nested backticked operator (infixr, I think)?

@jdegoes
Copy link
Copy Markdown
Contributor Author

jdegoes commented Mar 24, 2015

No, a 'foo' c 'foo' d will come out infixl 9, I think.

That might be a reason for making these left-associative. Actually, I originally wanted to make both nested tuples and nested eithers left-associative, because then you get the most useful definitions for Functor, et al. e.g. Tuple4 a b c d operates on d naturally, because by associativity it's Tuple (((Tuple a) b) c) d.

I asked around and discovered that right-associative was the most common way to define these, but still don't have a good reason for it. I'd be happy to change both nested modules to left-associative, if you think that's a good change.

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 24, 2015

I think those are both good reasons to prefer left associative, if infix operators do in fact give things that way round.

@jdegoes
Copy link
Copy Markdown
Contributor Author

jdegoes commented Mar 24, 2015

OK, will amend this one and submit another one to change associativity.

@jdegoes
Copy link
Copy Markdown
Contributor Author

jdegoes commented Mar 24, 2015

Amended & ready to merge, PR coming up for tuples.

paf31 added a commit that referenced this pull request Mar 24, 2015
@paf31 paf31 merged commit 9d1112c into purescript:master Mar 24, 2015
@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 24, 2015

👍 Thanks!

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

Successfully merging this pull request may close these issues.

2 participants