Proposal #2875: remove StringRep and StringConstr
[ghc-base.git] / Data / Bits.hs
index 9a20b35..18c1f6d 100644 (file)
@@ -1,4 +1,4 @@
-{-# OPTIONS_GHC -fno-implicit-prelude #-}
+{-# OPTIONS_GHC -XNoImplicitPrelude #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Data.Bits
@@ -95,9 +95,9 @@ class Num a => Bits a where
         question. -}
     shift             :: a -> Int -> a
 
-    x `shift`   i | i<0  = x `shiftR` (-i)
-                  | i==0 = x
-                  | i>0  = x `shiftL` i
+    x `shift`   i | i<0       = x `shiftR` (-i)
+                  | i>0       = x `shiftL` i
+                  | otherwise = x
 
     {-| @'rotate' x i@ rotates @x@ left by @i@ bits if @i@ is positive,
         or right by @-i@ bits otherwise.
@@ -109,9 +109,9 @@ class Num a => Bits a where
         question. -}
     rotate            :: a -> Int -> a
 
-    x `rotate`  i | i<0  = x `rotateR` (-i)
-                  | i==0 = x
-                  | i>0  = x `rotateL` i
+    x `rotate`  i | i<0       = x `rotateR` (-i)
+                  | i>0       = x `rotateL` i
+                  | otherwise = x
 
     {-
     -- Rotation can be implemented in terms of two shifts, but care is
@@ -222,6 +222,10 @@ instance Bits Int where
         i'# = word2Int# (int2Word# i# `and#` int2Word# (wsib -# 1#))
         wsib = WORD_SIZE_IN_BITS#   {- work around preprocessor problem (??) -}
     bitSize  _             = WORD_SIZE_IN_BITS
+
+    {-# INLINE shiftR #-}
+    -- same as the default definition, but we want it inlined (#2376)
+    x `shiftR`  i = x `shift`  (-i)
 #else /* !__GLASGOW_HASKELL__ */
 
 #ifdef __HUGS__