Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Add lookup{LT,LE,GT,GE}, find{Min,Max} #56

Merged
merged 1 commit into from
Jun 22, 2016
Merged

Add lookup{LT,LE,GT,GE}, find{Min,Max} #56

merged 1 commit into from
Jun 22, 2016

Conversation

mtolly
Copy link
Contributor

@mtolly mtolly commented Jan 28, 2016

Closes #52. I needed the lookupXX functions to port some GHCJS code, and then I needed findMin/findMax to implement lookupLT/GT so I figured I'd export those as well.

All the functions also have thorough tests. I am new to PureScript so do let me know if you want any style changes or things like that :)

@garyb
Copy link
Member

garyb commented Jan 28, 2016

Looks good to me 👍

@paf31?

@paf31
Copy link
Contributor

paf31 commented Jan 28, 2016

Looks great, but can we save some duplication by reversing orders perhaps? I'm not fussed either way, really, since the tests pass.

👍 Thanks!

@mtolly
Copy link
Contributor Author

mtolly commented Feb 15, 2016

Sorry this dropped off my radar for a bit. Possibly you could condense them, but I don't see how to do it both elegantly and efficiently. You'd have to flip the whole tree and also reverse the comparison operator (probably with the Down wrapper). That'd be too much overhead for my tastes. Or you could have a shared implementation take a Boolean to make every left/right decision, but I think that'd make the code a lot less readable. If there were more potential savings it might make sense but here it seems not worth it.

@mtolly
Copy link
Contributor Author

mtolly commented Feb 15, 2016

While I've got this PR open, would you be open to another PR that adds an Internal/Unsafe/similarly-named module exporting the Map constructors? I've had to write some fairly specialized functions for efficient Map traversal (https://github.com/mtolly/onyxite-customs/blob/faf480b/player/src/OnyxMap.purs#L383-L421) that require access to the constructors, so currently I'm using a local modified version of the module and it would be nice to not have to (i.e. less code to manage + smaller compiled blob size).

@mtolly
Copy link
Contributor Author

mtolly commented Jun 22, 2016

Is this ready to be merged?

@garyb
Copy link
Member

garyb commented Jun 22, 2016

Can you rebase it please?

@mtolly
Copy link
Contributor Author

mtolly commented Jun 22, 2016

Done, and updated to PS 0.9.1.

@garyb
Copy link
Member

garyb commented Jun 22, 2016

Thanks very much!

@garyb
Copy link
Member

garyb commented Jun 22, 2016

And sorry it got left for so long.

@garyb garyb merged commit f831f48 into purescript-deprecated:master Jun 22, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants