[Haskell-cafe] Precedence of plus and bit-wise-and

Levent Erkok erkokl at gmail.com
Wed Aug 16 00:07:44 UTC 2017


I was surprised today to find that C and Haskell differ on the precedence
of addition and bit-wise and.

In Haskell, bit-wise-and (.&.) binds tighter. In C, it's the other way
around.

While I like Haskell's precedence better, this was a gotcha; and I wondered
if this behavior is documented somewhere. I looked through the Haskell
wiki, but couldn't find anything pertinent.

Discrepancies are always problematic. Without bike-shedding a lot, does
anyone know if this was a conscious decision or merely a more natural one
to take?

Cheers,

-Levent.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170815/bbade5db/attachment.html>


More information about the Haskell-Cafe mailing list