-
Notifications
You must be signed in to change notification settings - Fork 90
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
Int bottom is not safe #312
Comments
In the 32 bit integer arithmetic, |
It makes a possible for |
PureScript Int is a representation of 32 bit signed integer so in my opinion it is even reasonable behavior. |
Well, maybe I should just "git gud" and acknowledge this edge case is quite common. But what seemed nice to me was to raise the value by 1 so these behaviours go away. Perhaps the choice of what is best would come down to is what assumption people are going to do more "assumption oriented coding" around - |
The choices here seem to be between:
For the standard integer type of a general-purpose programming language like PureScript, I think (1) makes more sense. |
purescript-prelude/src/Data/Bounded.js
Lines 1 to 2 in f4cad0a
The bottom and top values for
Int
are listed as above. The problem here is that-bottom
is greater thantop
, which meansbottom
is actually not a safe value for theRing
instance ofInt
. You can verify for yourself thatnegate bottom == bottom
!The text was updated successfully, but these errors were encountered: