Skip to content

Add compiler derived Prim.Row.Nub class#3293

Merged
garyb merged 1 commit intopurescript:masterfrom
natefaubion:row-nub-class
Apr 7, 2018
Merged

Add compiler derived Prim.Row.Nub class#3293
garyb merged 1 commit intopurescript:masterfrom
natefaubion:row-nub-class

Conversation

@natefaubion
Copy link
Copy Markdown
Contributor

This adds a compiler derived class for removing duplicates from rows. This is technically possible to achieve using RowListNub, but the machinery is substantial and I think this is a common enough usecase to warrant a primitive class. This can be used to implement a more type-safe record merge than a bare Union.

@garyb
Copy link
Copy Markdown
Member

garyb commented Mar 28, 2018

Seems like a good idea to me!

@natefaubion
Copy link
Copy Markdown
Contributor Author

I would also like to do the same for Lacks in the same vein as Union. Lacks is currently implemented in terms of Union and RowCons, but the encoding leaks when it comes to errors, and it can be difficult to decipher (where is this Entry type coming from?). I realize there's less of a benefit here, but I think it's worth it.

@kritzcreek
Copy link
Copy Markdown
Member

If we merge #3292 first, do we want to update the type parameters to be a little more descriptive in here as well?

@eviefp
Copy link
Copy Markdown
Contributor

eviefp commented Apr 6, 2018

I've no problem to fix merge issues / update the type params for Nub on #3292 if you merge this first.

@garyb garyb merged commit 86d8b5c into purescript:master Apr 7, 2018
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