Introduce operator aliases by garyb · Pull Request #1691 · purescript/purescript · GitHub
Skip to content

Introduce operator aliases#1691

Merged
garyb merged 2 commits into
masterfrom
operator-aliases
Dec 13, 2015
Merged

Introduce operator aliases#1691
garyb merged 2 commits into
masterfrom
operator-aliases

Conversation

@garyb

@garyb garyb commented Dec 6, 2015

Copy link
Copy Markdown
Member

Resolves #806

This probably isn't the best way of handling it in the long term, it would be nice to desugar during codegen rather than upfront as we'll probably get better error messages that way, but while we're supporting both old and new syntax this seemed a reasonable approach for now.

@garyb

garyb commented Dec 6, 2015

Copy link
Copy Markdown
Member Author

Comment thread src/Language/PureScript/Docs/Types.hs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this needs an update to Pursuit, correct? Or is this a backwards-compatible change? Does perhaps handle undefined fields?

Maybe we need to bump the min compiler version there. /cc @hdgarrood

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, so yeah, one for @hdgarrood.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently not, perhaps is kind of like purescript's Data.Foreign.Null.readNull: https://hackage.haskell.org/package/aeson-better-errors-0.9.0/docs/Data-Aeson-BetterErrors.html#v:perhaps
But there is also keyMay, which would give you Nothing if the property wasn't there, so as far as I can tell, if we used that, we would probably be able to keep accepting uploads from people on 0.7.x. I'm not really sure about what to do here; it's hard to predict whether that would be worth doing.

By the way, does this line up with the ToJSON instance? You can run the test in psc-publish/test to do a quick to-JSON-and-back test. (I should make that into an actual test.) I think this might be using Aeson's ToJSON (,) instance at the moment, which might not work with this parser.

@paf31

paf31 commented Dec 11, 2015

Copy link
Copy Markdown
Contributor

I like it! I tried this before but didn't think of the renaming-after-reordering approach for some reason, which threw me off.

Agreed about handling this in codegen, but this is great for now.

Prelude changes sound good to me, but why 1.0? Don't we want to wait until other things are ready and bump everything together?

@garyb

garyb commented Dec 12, 2015

Copy link
Copy Markdown
Member Author

Updated - identifier is the one we wanted rather than lname I think, as that covers _-prefixed idents too. Added the comments back to the operators sugar module.

It would seem that using perhaps in the aeson stuff will probably be backwards compatible given the description here, but Harry should definitely know given it's his library 😄

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking: once we require operators to be defined as aliases for other existing values, this addDefaultFixity function will no longer be necessary, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's right.

@garyb

garyb commented Dec 12, 2015

Copy link
Copy Markdown
Member Author

Switched to use keyMay instead of perhaps. I couldn't get the psc-publish tests to work though, so I'm not sure if the mentioned JSON instance issue is a problem or not.

@hdgarrood

Copy link
Copy Markdown
Contributor

Ok - I'll try to fix those tests up and integrate them into the normal test suite.

@hdgarrood

Copy link
Copy Markdown
Contributor

@garyb can you cherry-pick hdgarrood@4ab687c?

@garyb

garyb commented Dec 13, 2015

Copy link
Copy Markdown
Member Author

@hdgarrood done! (A while back actually, Travis is pretty slow currently). Weirdly failing in just one of the test setups...

@hdgarrood

Copy link
Copy Markdown
Contributor

Ah, looks like that new module TestPscPublish needs to be added to the other-modules section in the cabal file. Although I have no idea why it only failed once...

@phadej

phadej commented Dec 13, 2015

Copy link
Copy Markdown
Contributor

@hdgarrood because RUNSDISTTESTS=YES is only in one travis job. There are almost no sense to run it with all compiler versions, would just make builds slower.

@hdgarrood

Copy link
Copy Markdown
Contributor

Ah, of course - thanks.

@garyb

garyb commented Dec 13, 2015

Copy link
Copy Markdown
Member Author

That did it, thanks. I think this is ready to go if you're happy then @paf31?

@paf31

paf31 commented Dec 13, 2015

Copy link
Copy Markdown
Contributor

👍 Looks great!

garyb added a commit that referenced this pull request Dec 13, 2015
@garyb garyb merged commit 550fabe into master Dec 13, 2015
@garyb garyb deleted the operator-aliases branch December 13, 2015 15:58
@garyb

garyb commented Dec 13, 2015

Copy link
Copy Markdown
Member Author

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.

4 participants