default fixity for `quotRem`, `divMod` ??

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I was just bitten in ghci by `divMod` being the default infixl 9 instead of the same as `div` and `mod`. Sure enough, the standard prelude doesn't specify a fixity for `quotRem` and `divMod` even though `quot`, `rem`, `div`, and `mod` are all infixl 7. I propose that `quotRem` and `divMod` also become infixl 7. Isaac -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGdr7dHgcxvIWYTTURAu07AKCb0RAI343lnRlH1FgI1rMy0dx1FQCfcnsV g6HUB5vDVbk9LPGi51WpY+o= =iESL -----END PGP SIGNATURE-----

Hi,
This seems like a good idea. We should make sure that we are writing
down such bugfixes somewhere besides the mailing list so that they do
not get lost.
-Iavor
On 6/18/07, Isaac Dupree
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I was just bitten in ghci by `divMod` being the default infixl 9 instead of the same as `div` and `mod`. Sure enough, the standard prelude doesn't specify a fixity for `quotRem` and `divMod` even though `quot`, `rem`, `div`, and `mod` are all infixl 7. I propose that `quotRem` and `divMod` also become infixl 7.
Isaac -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGdr7dHgcxvIWYTTURAu07AKCb0RAI343lnRlH1FgI1rMy0dx1FQCfcnsV g6HUB5vDVbk9LPGi51WpY+o= =iESL -----END PGP SIGNATURE----- _______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime

Hello Isaac, Monday, June 18, 2007, 9:20:29 PM, you wrote:
I was just bitten in ghci by `divMod` being the default infixl 9 instead of the same as `div` and `mod`.
one of my hard-to-find bugs was exactly in this area: i wrote something like x `div` y+1 instead of x `div` (y+1) so, based on practical experience, i have opposite proposal: give to all `op` lowest precedence (a bit higher than of '$') because it complies to its visual effect otoh this relates to my other (too revolutionary) proposal: bind "x+y" more closely than "x * y" for any (+) and (*), i.e. operation written without spaces around it should increase its priority by whole 10 points. it will allow significantly decrease amount of parentheses: f a+b*c x:xs ++ g u&&v record.$field -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Bulat Ziganshin wrote:
Hello Isaac,
Monday, June 18, 2007, 9:20:29 PM, you wrote:
I was just bitten in ghci by `divMod` being the default infixl 9 instead of the same as `div` and `mod`.
one of my hard-to-find bugs was exactly in this area: i wrote something like x `div` y+1 instead of x `div` (y+1)
so, based on practical experience, i have opposite proposal: give to all `op` lowest precedence (a bit higher than of '$') because it complies to its visual effect
I wonder how much code this would break. Maybe we could have a warning for anything that relies on the default fixity anyway (for things like x `div` y+1 , that don't give a type error anyway). And it would be nice if even e.g. `div` had the same precedence as all other `op`s in existence -- but I'm pretty sure that would break a bunch of code. Isaac -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGeDX1HgcxvIWYTTURAqA7AJ9WqCXZy2X/LhV18o6dpENaYx0k6gCgqXeG yAubnfVm3LBBj3l1/z/MZ18= =G8Uf -----END PGP SIGNATURE-----
participants (3)
-
Bulat Ziganshin
-
Iavor Diatchki
-
Isaac Dupree