Use OPTIONS rather than OPTIONS_GHC for pragmas
[ghc-hetmet.git] / compiler / basicTypes / BasicTypes.lhs
index d1ad0be..db66ca2 100644 (file)
@@ -1,4 +1,5 @@
 %
+% (c) The University of Glasgow 2006
 % (c) The GRASP/AQUA Project, Glasgow University, 1997-1998
 %
 \section[BasicTypes]{Miscellanous types}
@@ -13,6 +14,13 @@ types that
 \end{itemize}
 
 \begin{code}
+{-# OPTIONS -w #-}
+-- The above warning supression flag is a temporary kludge.
+-- While working on this module you are encouraged to remove it and fix
+-- any warnings in the module. See
+--     http://hackage.haskell.org/trac/ghc/wiki/CodingStyle#Warnings
+-- for details
+
 module BasicTypes(
        Version, bumpVersion, initialVersion,
 
@@ -235,7 +243,7 @@ isBoxed Unboxed = False
 %*                                                                     *
 %************************************************************************
 
-\begin{code} 
+\begin{code}
 data RecFlag = Recursive 
             | NonRecursive
             deriving( Eq )
@@ -367,8 +375,6 @@ defn of OccInfo here, safely at the bottom
 data OccInfo 
   = NoOccInfo          -- Many occurrences, or unknown
 
-  | RulesOnly          -- Occurs only in the RHS of one or more rules
-
   | IAmDead            -- Marks unused variables.  Sometimes useful for
                        -- lambda and case-bound variables.
 
@@ -379,31 +385,14 @@ data OccInfo
 
   | IAmALoopBreaker    -- Used by the occurrence analyser to mark loop-breakers
                        -- in a group of recursive definitions
-       !Bool           -- True <=> This loop breaker occurs only the RHS of a RULE
-\end{code}
-
-Note [RulesOnly]
-~~~~~~~~~~~~~~~~
-The RulesOnly constructor records if an Id occurs only in the RHS of a Rule.
-Similarly, the boolean in IAmLoopbreaker True if the only reason the Id is a
-loop-breaker only because of recursion through a RULE. In that case,
-we can ignore the loop-breaker-ness for inlining purposes.  Example
-(from GHC.Enum):
+       !RulesOnly      -- True <=> This loop breaker mentions the other binders
+                       --          in its recursive group only in its RULES, not
+                       --          in its rhs
+                       --  See OccurAnal Note [RulesOnly]
 
-  eftInt :: Int# -> Int# -> [Int]
-  eftInt x y = ...(non-recursive)...
-
-  {-# INLINE [0] eftIntFB #-}
-  eftIntFB :: (Int -> r -> r) -> r -> Int# -> Int# -> r
-  eftIntFB c n x y = ...(non-recursive)...
-
-  {-# RULES
-  "eftInt"  [~1] forall x y. eftInt x y = build (\ c n -> eftIntFB c n x y)
-  "eftIntList"  [1] eftIntFB  (:) [] = eftInt
-   #-}
+type RulesOnly = Bool
+\end{code}
 
-The two look mutually recursive only because of their RULES;
-we don't want that to inhibit inlining!
 
 \begin{code}
 isNoOcc :: OccInfo -> Bool
@@ -455,7 +444,6 @@ isFragileOcc other      = False
 instance Outputable OccInfo where
   -- only used for debugging; never parsed.  KSW 1999-07
   ppr NoOccInfo           = empty
-  ppr RulesOnly           = ptext SLIT("RulesOnly")
   ppr (IAmALoopBreaker ro) = ptext SLIT("LoopBreaker") <> if ro then char '!' else empty
   ppr IAmDead             = ptext SLIT("Dead")
   ppr (OneOcc inside_lam one_branch int_cxt)
@@ -510,6 +498,10 @@ instance Outputable StrictnessMark where
 \begin{code}
 data SuccessFlag = Succeeded | Failed
 
+instance Outputable SuccessFlag where
+    ppr Succeeded = ptext SLIT("Succeeded")
+    ppr Failed    = ptext SLIT("Failed")
+
 successIf :: Bool -> SuccessFlag
 successIf True  = Succeeded
 successIf False = Failed