Commit 23aaae78 authored by simonpj's avatar simonpj

[project @ 2001-08-23 08:46:23 by simonpj]

Add cg050
parent 3c68c8d9
......@@ -54,3 +54,6 @@ test "cg046" { vtr("", "", "") }
test "cg047" { vtr("", "", "") }
test "cg048" { vtr("", "", "") }
test "cg049" { vtr( "-funbox-strict-fields", "", "") }
-- NB: be sure to run cg050 *without* -O; that's what showed the bug
test "cg050" { vtr( "", "", "") }
-- !! Test strict, recursive newtypes
-- This test made a pre-5.02 fall over
-- Reason: the seq arising from the !F didn't see that
-- the represtation of F is a function.
-- NB It's crucial to compile this test *without* -O
-- The $ then prevents the 'F' from seeing the '\x'
-- and hence makes the evaluation happen at runtime
module Main ( main ) where
newtype F = F (Int -> Val) -- NB: F and Val are
data Val = VFn !F | VInt !Int -- mutually recursive
f :: Val -> Val
f (VFn (F f)) = f 4
main = print (f (VFn (F $ (\x -> VInt (x+3)))))
instance Show Val where
show (VInt n) = show n
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment