-
Notifications
You must be signed in to change notification settings - Fork 24
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
odd behaviour of Sz1 when subtracting something #114
Comments
Hello again, and you again find some more odd behavior with regards to This is a very good observation. However, it is a totally explainable one: This is not the first place in Haskell when this behavior related to how numeric literals are desugared produces surprising results. In fact you can replicate similar behavior with the import Numeric.Natural
f :: Natural -> Natural
f = ($) (\ x -> x - 1)
f' :: Natural -> Natural
f' = ($) (+ (- 1))
ok = f 10 -- 9
bug = f' 10 -- 10 <-- THIS SHOULD BE 9. Which results in: λ> ok
9
λ> bug
*** Exception: arithmetic underflow We could fix this deficiency for The proper workaround is to unwrap Thank you for pointing out this deficiency. |
Clear explanation, thanks! I didn't know there was a similar issue with |
Hello again. There is something odd going on here. With
Int
it works OK but withSz1
there is a problem. (GHC 8.10.4; massiv 0.6). Thanks!The text was updated successfully, but these errors were encountered: