I wasn't involve in the decision but personally I would expect "&" (and) to have precedence like "*" and "|" (or) to have precedence like "+", whether bitwise or logical.

It seems from what you're saying that's how Haskell works. Flipping it would be more of a gotcha to me.

On Wed, 16 Aug 2017 at 10:08 am, Levent Erkok <erkokl@gmail.com> wrote:
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.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.