[project @ 1998-11-16 18:14:44 by simonm]
[ghc-hetmet.git] / ghc / tests / typecheck / should_run / tcrun002.hs
1 --!!! space leak from overloading !!!
2 module Main where
3
4 -- This program develops a space leak if sfoldl isn't compiled with some
5 -- care.  See comment about polymorphic recursion in TcMonoBinds.lhs
6
7 import System(getArgs)
8 import PrelIOBase
9
10 sfoldl :: (a -> Int -> a) -> a -> [Int] -> a
11 sfoldl f z [] = z
12 sfoldl f z (x:xs) = _scc_ "sfoldl1" (sfoldl f fzx (fzx `seq` xs))
13                   where fzx = _scc_ "fzx" (f z x)
14
15
16 main = IO (\s -> case print (sfoldl (+) (0::Int) [1..200000]) of { IO a -> a s })