From: simonm Date: Thu, 16 Oct 1997 12:17:07 +0000 (+0000) Subject: [project @ 1997-10-16 12:17:05 by simonm] X-Git-Tag: Approx_2487_patches~1372 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=b758d0f1869982e2d758f1bb156f325f719eb538;p=ghc-hetmet.git [project @ 1997-10-16 12:17:05 by simonm] polymorphic recursion/space leak test --- diff --git a/ghc/tests/typecheck/should_run/tcrun002.hs b/ghc/tests/typecheck/should_run/tcrun002.hs new file mode 100644 index 0000000..7917402 --- /dev/null +++ b/ghc/tests/typecheck/should_run/tcrun002.hs @@ -0,0 +1,18 @@ +module Main where + +--!!! space leak from overloading !!! + +-- This program develops a space leak if sfoldl isn't compiled with some +-- care. See comment about polymorphic recursion in TcMonoBinds.lhs + +import System(getArgs) +import IOBase +import STBase + +sfoldl :: Eval a => (a -> Int -> a) -> a -> [Int] -> a +sfoldl f z [] = z +sfoldl f z (x:xs) = _scc_ "sfoldl1" (sfoldl f fzx (fzx `seq` xs)) + where fzx = _scc_ "fzx" (f z x) + + +main = IO (\s -> case print (sfoldl (+) (0::Int) [1..200000]) of { IO a -> a s }) diff --git a/ghc/tests/typecheck/should_run/tcrun002.stdout b/ghc/tests/typecheck/should_run/tcrun002.stdout new file mode 100644 index 0000000..928909f --- /dev/null +++ b/ghc/tests/typecheck/should_run/tcrun002.stdout @@ -0,0 +1 @@ +-1474736480