[clean up E.Eta code some, use bottoming out info when determining whnfOrBot and isCheap
John Meacham <john@repetae.net>**20060317010612] hunk ./E/Eta.hs 31
-import Info.Types(Arity(..))
+import Info.Types
hunk ./E/Eta.hs 45
-isOneShot x = False
+isOneShot x = getProperty prop_ONESHOT x
hunk ./E/Eta.hs 75
-annotateArity' at nfo = Info.insert (Arity n) $ Info.insert at nfo where
-    (_,n) = arity at
+annotateArity' at nfo = Info.insert (Arity n (b == ABottom)) $ Info.insert at nfo where
+    (b,n) = arity at
hunk ./E/Eta.hs 155
+-- | eta expand a definition
hunk ./E/Eta.hs 177
+-- | eta expand a use of a value
hunk ./E/Eta.hs 184
-    mticks (length ets) ("EtaExpand.{" ++ tvrShowName t)
+    mticks (length ets) ("EtaExpand.use.{" ++ tvrShowName t)
hunk ./E/Values.hs 241
-isCheap e | (EVar v,xs) <- fromAp e, Just (Arity n) <- Info.lookup (tvrInfo v), length xs < n = True  -- Partial applications are cheap
+isCheap e | (EVar v,xs) <- fromAp e, Just (Arity n b) <- Info.lookup (tvrInfo v) =
+        (length xs < n)  -- Partial applications are cheap
+          || (b && length xs >= n) -- bottoming out routines are cheap
hunk ./E/Values.hs 256
-whnfOrBot e = isAtomic e
+whnfOrBot e | isAtomic e = True
+whnfOrBot e | (EVar v,xs) <- fromAp e, Just (Arity n True) <- Info.lookup (tvrInfo v), length xs >= n = True
+whnfOrBot _ = False
hunk ./Info/Types.hs 18
--- | how many manifest lambdas are in a functions definition
-newtype Arity = Arity Int
-    deriving(Typeable,Show,Ord,Eq,Num,Binary)
+-- | how many arguments a function my be applied to before it performs work and whether it bottoms out after that many arguments
+data Arity = Arity Int Bool
+    deriving(Typeable,Show,Ord,Eq)
hunk ./Info/Types.hs 67
+prop_ONESHOT = toAtom "_ONESHOT"
hunk ./Main.hs 147
-manifestLambdas :: E -> Arity
-manifestLambdas e = Arity (f 0 e) where
-    f n (ELam _ e) = let n' = n + 1 in n' `seq` f n' e
-    f n _ = n