Commit 4039397c authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Test Trac #7797

parent 3a596be3
{-# LANGUAGE ExistentialQuantification #-}
module Main where
import T7797a
data Box = forall a. (Size a) => Box a a
box = Box (go 10000000) (go 10000000) where
go :: Int -> [Int]
go 0 = []
go n = 1 : go (n - 1)
{-# NOINLINE box #-}
main = print $ case box of
Box l r -> size l r
module T7797a where
class Size t where
size :: t -> t -> Int
burg :: t -> t
instance (Ord a, Num a) => Size [a] where
{-# SPECIALISE instance Size [Int] #-}
size (x:xs) (y:ys) | x+y > 4 = size xs ys
| otherwise = size xs ys
size _ _ = 0
burg = error "urk"
......@@ -261,3 +261,16 @@ test('T7436',
],
compile_and_run,
['-O'])
test('T7797',
[stats_num_field('bytes allocated',
[(wordsize(32), 360940756, 5),
# expected value: 2685858140 (x86/OS X)
# expected: 360940756 (x86/Linux)
(wordsize(64), 480050944, 5)]),
# expected: 480050944 (amd64/Linux)
only_ways(['normal'])
],
compile_and_run,
['-O'])
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