Fold integer-simple.git into ghc.git (re #8545)
[ghc.git] / testsuite / tests / perf / should_run / T5949.hs
1 import Data.List
2
3 {-
4 This should get a worker that takes three arguments.
5
6 bad:
7
8 Rec {
9 $we_r1z8
10 :: (GHC.Types.Int, GHC.Types.Int)
11 -> GHC.Prim.Int# -> (# GHC.Types.Int, GHC.Types.Int #)
12 [GblId, Arity=2, Caf=NoCafRefs, Str=DmdType S(AA)L]
13 $we_r1z8 =
14 \ (w_s1yf :: (GHC.Types.Int, GHC.Types.Int))
15 (ww_s1yi :: GHC.Prim.Int#) ->
16 case GHC.Prim.># ww_s1yi 10 of _ {
17 GHC.Types.False -> $we_r1z8 w_s1yf (GHC.Prim.+# ww_s1yi 1);
18 GHC.Types.True ->
19 case w_s1yf of _ { (ww2_s1yp, ww3_s1yq) ->
20 (# ww2_s1yp, ww3_s1yq #)
21 }
22 }
23 end Rec }
24
25 Good:
26
27 Rec {
28 $we_r2qK
29 :: GHC.Types.Int
30 -> GHC.Types.Int
31 -> GHC.Prim.Int#
32 -> (# GHC.Types.Int, GHC.Types.Int #)
33 [GblId, Arity=3, Caf=NoCafRefs, Str=DmdType <L,U><L,U><L,U>]
34 $we_r2qK =
35 \ (ww_s2pS :: GHC.Types.Int)
36 (ww1_s2pT :: GHC.Types.Int)
37 (ww2_s2pX :: GHC.Prim.Int#) ->
38 case GHC.Prim.tagToEnum# @ GHC.Types.Bool (GHC.Prim.># ww2_s2pX 10)
39 of _ [Occ=Dead] {
40 GHC.Types.False ->
41 $we_r2qK ww_s2pS ww1_s2pT (GHC.Prim.+# ww2_s2pX 1);
42 GHC.Types.True -> (# ww_s2pS, ww1_s2pT #)
43 }
44 end Rec }
45
46 -}
47
48
49
50 e :: (Int, Int) -> Int -> (Int, Int)
51 e x y = x `seq` if y > 10
52 then x
53 else e x (y + 1)
54
55
56 main = foldr (seq) 0 [e (n,0) 0| n <- [0..10000]] `seq` return ()