module Main where import Trace(trace) fac :: Int-> Int fac n = fac0 n 1 where fac0 n acc = trace "Bah!" $ if n == 0 then acc else seq acc $ fac0 (n-1) (trace "Foo!" (n*acc)) getLines :: IO String getLines = getit "" where getit res = do str<- getLine if null str then return res else seq res $ getit (trace "Foo!" (res++ str)) main = do putStrLn (show (fac 10)) getLines >>= putStrLn