Skip to content

Conversation

@LiamGoodacre
Copy link
Member

Resolves #5

I've added two different variations on the newtype:

  • UnsafeRefEq which only uses unsafeRefEq as it's Eq implementation
  • UnsafeRefEqFallback which first checks unsafeRefEq, but falls back to the underlying Eq instance

LiamGoodacre referenced this pull request in purescript/purescript-prelude Sep 19, 2018
Running Eq on large nested data structures can be expensive (think rose trees with 10^5 items), so checking for reference equality before traversing the array can result in some significant gains.
@LiamGoodacre
Copy link
Member Author

Not sure what's going on on travis. Looks like it tried to build before installing bower dependencies?

@LiamGoodacre
Copy link
Member Author

OH, we only depend on prelude as a dev dependency! oops!

@garyb
Copy link
Member

garyb commented Sep 20, 2018

It's probably fine to add that, despite it technically being breaking... maybe? 😄

@LiamGoodacre
Copy link
Member Author

Added the dependency on purescript-prelude. I'm okay with this being either a v3.1 or a v4. Whichever you're happiest with!

@klntsky
Copy link

klntsky commented Nov 9, 2019

Any progress on this? Also, UnsafeRefEqFallback isn't really unsafe.

@thomashoneyman
Copy link
Contributor

Coming back around to this -- I don't see any reason not to merge this in and do a release. This is a nice thing to have. @LiamGoodacre, @garyb, do you have any objections to merging?

@thomashoneyman thomashoneyman changed the base branch from master to main September 12, 2020 01:10
@thomashoneyman thomashoneyman merged commit a878068 into purescript-contrib:main Oct 4, 2020
@LiamGoodacre LiamGoodacre deleted the feature/unsafe-eq branch December 11, 2020 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Feature: add a newtype for unsafe reference equality ===

4 participants