Fix typo
[ghc-hetmet.git] / compiler / utils / FastTypes.lhs
index bb92c8c..bce98f4 100644 (file)
@@ -1,5 +1,5 @@
 %
-% (c) The University of Glasgow, 2000
+% (c) The University of Glasgow, 2000-2006
 %
 \section{Fast integers and booleans}
 
@@ -8,16 +8,12 @@ module FastTypes (
     FastInt, _ILIT, iBox, iUnbox,
     (+#), (-#), (*#), quotFastInt, negateFastInt,
     (==#), (<#), (<=#), (>=#), (>#),
-
-    FastBool, fastBool, isFastTrue, fastOr, fastAnd
   ) where
 
-#include "HsVersions.h"
-
 #if defined(__GLASGOW_HASKELL__)
 
 -- Import the beggars
-import GLAEXTS
+import GHC.Exts
        ( Int(..), Int#, (+#), (-#), (*#), 
          quotInt#, negateInt#, (==#), (<#), (<=#), (>=#), (>#)
        )
@@ -29,17 +25,6 @@ iUnbox (I# x) = x
 quotFastInt   = quotInt#
 negateFastInt = negateInt#
 
-type FastBool = Int#
-fastBool True  = 1#
-fastBool False = 0#
-isFastTrue x = x ==# 1#
-
-fastOr 1# _ = 1#
-fastOr 0# x = x
-
-fastAnd 0# x = 0#
-fastAnd 1# x = x
-
 #else /* ! __GLASGOW_HASKELL__ */
 
 type FastInt = Int
@@ -57,9 +42,27 @@ negateFastInt = negate
 (>=#) = (>=)
 (>#)  = (>)
 
-type FastBool = Bool
-fastBool x = x
-_IS_TRUE_ x = x
+--These are among the type-signatures necessary for !ghc to compile
+-- but break ghc (can't give a signature for an import...)
+--Note that the comparisons actually do return Bools not FastBools.
+(+#) :: FastInt -> FastInt -> FastInt
+(-#) :: FastInt -> FastInt -> FastInt
+(*#) :: FastInt -> FastInt -> FastInt
+(==#) :: FastInt -> FastInt -> Bool
+(<#) :: FastInt -> FastInt -> Bool
+(<=#) :: FastInt -> FastInt -> Bool
+(>=#) :: FastInt -> FastInt -> Bool
+(>#) :: FastInt -> FastInt -> Bool
 
 #endif /* ! __GLASGOW_HASKELL__ */
+
+-- type-signatures will improve the non-ghc-specific versions
+-- and keep things accurate (and ABLE to compile!)
+_ILIT :: Int -> FastInt
+iBox :: FastInt -> Int
+iUnbox :: Int -> FastInt
+
+quotFastInt :: FastInt -> FastInt -> FastInt
+negateFastInt :: FastInt -> FastInt
+
 \end{code}