# The Haskell Bit library in nhc98

This document describes the interface to the Bit library.

      module Bit where

      infixl  7 ^&
      infixl  6 ^|
      infixl  5 `xor`
      infixl  8 ^<<
      infixl  8 ^>>
      infixl  8 `asr`
      infixl  8 `rol`
      infixl  8 `ror`

      class Integral a => Bits a where
          (^&)    :: a -> a -> a		-- bit-wise and
          (^|)    :: a -> a -> a		-- bit-wise or
          xor     :: a -> a -> a		-- bit-wise xor
          compl   :: a -> a			-- bit-wise complement
          (^<<)   :: a -> Int -> a		-- left shift
          (^>>)   :: a -> Int -> a		-- right shift
          asr     :: a -> Int -> a		-- arithmetic right shift
          rol     :: a -> Int -> a		-- rotate left
          ror     :: a -> Int -> a		-- rotate right
          test    :: Int -> a -> Bool	-- report n'th bit
          set     :: Int -> a -> a		-- set n'th bit
          clear   :: Int -> a -> a		-- clean n'th bit
          bitSize :: a -> Int		-- bit-width of type (not value)

      instance Bits Int where ...

The latest updates to these pages are available on the WWW from `http://www.cs.york.ac.uk/fp/nhc98/`

1998.03.26
York Functional Programming Group