Skip to content

ADD: Bounded Number instance. #162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2018
Merged

Conversation

erisco
Copy link
Contributor

@erisco erisco commented Mar 24, 2018

Because ∀x::Number. x ≠ NaN ⇒ x ≤ ∞ ∧ -∞ ≤ x.

@garyb
Copy link
Member

garyb commented Mar 24, 2018

This was proposed before, see #116 for previous discussion

@erisco
Copy link
Contributor Author

erisco commented Mar 24, 2018

The proposal there was for top = Number.MAX_VALUE and bottom = Number.MIN_VALUE which is not what I am proposing here.

@paf31
Copy link
Contributor

paf31 commented Mar 29, 2018

👍 from me, actually. The linked post says "Number is meant to represent the real numbers", which I think is true in spirit, but (NaN aside), it seems like it'd be useful to change that to the extended reals with +/- infinite, have this instance and be able to use a Min or Max monoid, for example.

@garyb
Copy link
Member

garyb commented Mar 29, 2018

Sorry, missed your response to this! Using infinities seems fine to me too since it obeys the laws (ignoring NaN), obviously if someone tries to enumerate top to bottom they're going to have a bad time, but it's not a BoundedEnum so there's no implication that should be a thing anyway.

@garyb garyb merged commit aad9768 into purescript:master Apr 7, 2018
@chexxor
Copy link
Contributor

chexxor commented Apr 10, 2018

Thanks for working on this, @erisco! I'd been curious about it for awhile, myself. :)

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