Hi David,

You're right, I keep forgetting to look at the source code.

And I wasn't aware of the info (:i) command. Should come in handy in the future.

Michael

--- On Mon, 9/6/10, David Menendez <d...@zednenem.com> wrote:

From: David Menendez <d...@zednenem.com>
Subject: Re: [Haskell-cafe] Operator precedence
To: "michael rice" <nowg...@yahoo.com>
Cc: haskell-cafe@haskell.org, "Daniel Díaz" <lazy.dd...@gmail.com>
Date: Monday, September 6, 2010, 1:50 PM

On Mon, Sep 6, 2010 at 1:37 PM, michael rice <nowg...@yahoo.com> wrote:
>
> A "concrete" library?
>
> I'm playing around with Data.Bits. It has .&. and .|. which I assume are 
> functions
> (rather than operators) because I don't see and infix statement for them. 
> Correct?

.|. and .&. are operators because they are made from symbol
characters. Operators default to infixl 9 unless specified otherwise,
so no infix declaration is needed.
However, Data.Bits does have infix declarations for .&. and .|. :

infixl 8 `shift`, `rotate`, `shiftL`, `shiftR`, `rotateL`, `rotateR`
infixl 7 .&.
infixl 6 `xor`
infixl 5 .|.

If you want to check the fixity of an operator, use :info in GHCi.
Prelude Data.Bits> :i .|.
class (Num a) => Bits a where
  ...
  (.|.) :: a -> a -> a
  ...
   -- Defined in Data.Bits
infixl 5 .|.

--
Dave Menendez <d...@zednenem.com>
<http://www.eyrie.org/~zednenem/>



      
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to