From da72bd5d852ac0e01a00f5d54030a958fbcf72dc Mon Sep 17 00:00:00 2001 From: Isaac Dupree Date: Sun, 29 Apr 2007 19:14:22 +0000 Subject: [PATCH] fix non-GHC-specific variant of FastTypes I tested FastTypes.lhs with hugs (manually using cpp) as well as ghc. --- compiler/utils/FastTypes.lhs | 43 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/compiler/utils/FastTypes.lhs b/compiler/utils/FastTypes.lhs index c58346d..bcea61d 100644 --- a/compiler/utils/FastTypes.lhs +++ b/compiler/utils/FastTypes.lhs @@ -59,7 +59,48 @@ negateFastInt = negate type FastBool = Bool fastBool x = x -_IS_TRUE_ x = x +isFastTrue x = x +fastOr = (||) +fastAnd = (&&) + +--These are among the type-signatures necessary for !ghc to compile +-- but break ghc (can't give a signature for an import...) +(+#) :: 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__ */ +-- however it's still possible to check that these are +-- valid signatures nonetheless (e.g., ==# returns Bool +-- not FastBool/Int# !) +_signatures = + ( (+#) :: FastInt -> FastInt -> FastInt + , (-#) :: FastInt -> FastInt -> FastInt + , (*#) :: FastInt -> FastInt -> FastInt + , (==#) :: FastInt -> FastInt -> Bool + , (<#) :: FastInt -> FastInt -> Bool + , (<=#) :: FastInt -> FastInt -> Bool + , (>=#) :: FastInt -> FastInt -> Bool + , (>#) :: FastInt -> FastInt -> Bool + ) + +-- 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 + +fastBool :: Bool -> FastBool +isFastTrue :: FastBool -> Bool +fastOr :: FastBool -> FastBool -> FastBool +fastAnd :: FastBool -> FastBool -> FastBool + \end{code} -- 1.7.10.4