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

Clinton Mead clintonmead at gmail.com
Wed Aug 16 02:06:32 UTC 2017


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 at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170816/9271dac6/attachment.html>


More information about the Haskell-Cafe mailing list