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