Skip to content

Row contains#3411

Closed
justinwoo wants to merge 4 commits into
purescript:masterfrom
justinwoo:row-contains
Closed

Row contains#3411
justinwoo wants to merge 4 commits into
purescript:masterfrom
justinwoo:row-contains

Conversation

@justinwoo

@justinwoo justinwoo commented Aug 12, 2018

Copy link
Copy Markdown
Contributor

add Prim.Row.Contains solved type class

depends on #3389

@justinwoo

Copy link
Copy Markdown
Contributor Author

Errored out at cloning github repos as usual... but I guess we can come back to this in a bit

@justinwoo

Copy link
Copy Markdown
Contributor Author

This was fixed with some amended commits

@LiamGoodacre LiamGoodacre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you rebase? I merged the Boolean kind, so this can now depend on that.

Thanks! Sorry it's taken me so long to get to this.


solveRowContains :: [Type] -> Maybe [TypeClassDict]
solveRowContains [TypeLevelString sym, r, _] =
pure [ TypeClassDictionaryInScope [] 0 EmptyClassInstance [] C.RowContains [TypeLevelString sym, r, result] Nothing ]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We need to do a bit more than this. Currently if sym = "x" and r = (y :: Int | s), then we would result in False! In this situation we should defer to RowContains "x" s. This will be very similar to how the RowLacks instance is solved. (With canMakeProgress and cst).
Does that make sense?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I need to supply not only the rest of the row but also a result placeholder though, as RowContains "x" s result. Is there somewhere I can find this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think you can reuse the last argument: the _ in solveRowContains [TypeLevelString sym, r, _] =.

@justinwoo justinwoo Nov 25, 2018

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Cool, I tried it out and put it in the constraints

Comment thread src/Language/PureScript/Environment.hs Outdated
Comment thread src/Language/PureScript/Environment.hs Outdated
Comment thread src/Language/PureScript/Constants.hs Outdated
@justinwoo

Copy link
Copy Markdown
Contributor Author

updated to latest changes in master, requested changes has already been applied

@joelmccracken

Copy link
Copy Markdown

What is wrong with this PR?

@justinwoo

Copy link
Copy Markdown
Contributor Author

Cleaning up my github notifications

@justinwoo justinwoo closed this Jan 29, 2020
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.

3 participants