Stabilise benchmarks wrt. GC
[nofib.git] / spectral / hartel / listcopy / Main.hs
1 module Main (main) -- listcopy
2 where {
3 import System.Environment (getArgs);
4 --partain: import Fast2haskell;
5 #include "../Fast2haskell.hs"
6 strict_show_i::Int -> [Char];
7 strict_show_i x=miraseq x (show x);
8 strict_show_d::Double -> [Char];
9 strict_show_d x=miraseq x (show x);
10
11 type
12 T_var=[Char];
13 data
14 T_def=F_Def T_var [T_var] T_expr;
15 data
16 T_expr=F_Apl T_var [T_expr] | F_Cmp T_expr [T_qual] | F_Let [T_def] T_expr | F_Cns [Char] | F_Var T_var;
17 data
18 T_qual=F_Gen Int T_var T_expr | F_Fil T_expr;
19 f_var_cmp::T_var -> T_var -> Int;
20 f_var_cmp a_vx a_vy=
21 let {
22 f_char_cmp a_x a_y=((-) :: (Int -> Int -> Int)) (fromEnum a_x) (fromEnum a_y)
23 } in f_list_cmp f_char_cmp a_vx a_vy;
24 f_var_less,f_var_equal,f_var_greater::T_var -> T_var -> Bool;
25 f_var_less a_vx a_vy=((<) :: (Int -> Int -> Bool)) (f_var_cmp a_vx a_vy) (0 :: Int);
26 f_var_equal a_vx a_vy=((==) :: (Int -> Int -> Bool)) (f_var_cmp a_vx a_vy) (0 :: Int);
27 f_var_greater a_vx a_vy=((>) :: (Int -> Int -> Bool)) (f_var_cmp a_vx a_vy) (0 :: Int);
28 f_var_list_remove::[T_var] -> [T_var] -> [T_var];
29 f_var_list_remove a_vxs a_vys=f_remove_cmp f_var_cmp a_vxs a_vys;
30 f_def_cmp::T_def -> T_def -> Int;
31 f_def_cmp (F_Def a_vx a_vxs a_ex) (F_Def a_vy a_vyx a_ey)=f_var_cmp a_vx a_vy;
32 f_def_list_remove::[T_def] -> [T_def] -> [T_def];
33 f_def_list_remove a_vxs a_vys=f_remove_cmp f_def_cmp a_vxs a_vys;
34 c_prg::[T_def];
35 c_prg=
36 let {
37 r_va=F_Var "a";
38 r_vb=F_Var "b";
39 r_vc=F_Var "c";
40 r_vd=F_Var "d";
41 r_vh=F_Var "h";
42 r_vq=F_Var "q";
43 r_vx=F_Var "x";
44 r_vy=F_Var "y";
45 r_vz=F_Var "z";
46 r_vxs=F_Var "xs";
47 r_vys=F_Var "ys";
48 r_zero=F_Cns "0";
49 r_one=F_Cns "1";
50 r_true=F_Cns "true";
51 r_false=F_Cns "false"
52 } in (:) (F_Def "sqs" ((:) "xs" []) (F_Cmp (F_Apl "sq" ((:) r_vx []))
53 ((:) (F_Gen (1 :: Int) "x" r_vxs) ((:) (F_Fil (F_Apl "odd" ((:) r_vx []))) [])))) ((:)
54 (F_Def "xys" ((:) "xs" ((:) "ys" [])) (F_Cmp (F_Apl "," ((:) r_vx ((:) r_vy [])))
55 ((:) (F_Gen (2 :: Int) "x" r_vxs) ((:) (F_Gen (3 :: Int) "y" r_vys) [])))) ((:) (F_Def "sq" ((:) "x" [])
56 (F_Apl "*" ((:) r_vx ((:) r_vx [])))) ((:) (F_Def "odd" ((:) "x" []) (F_Apl "if"
57 ((:) (F_Apl "=" ((:) (F_Apl "%" ((:) r_vx ((:) r_one []))) ((:) r_zero [])))
58 ((:) r_true ((:) r_false []))))) ((:) (F_Def "q" ((:) "c" ((:) "d" [])) (F_Let
59 ((:) (F_Def "e" ((:) "z" []) (F_Apl "*" ((:) r_vc ((:) r_vz [])))) ((:)
60 (F_Def "p" ((:) "a" ((:) "b" [])) (F_Let ((:) (F_Def "f" ((:) "x"
61 ((:) "y" [])) (F_Apl "*" ((:) r_vc ((:) r_vx [])))) ((:) (F_Def "g" ((:) "y"
62 ((:) "z" [])) (F_Apl "f" ((:) r_vb ((:) r_vy [])))) ((:) (F_Def "h" [] (F_Apl "g"
63 ((:) r_va ((:) r_vd [])))) []))) (F_Apl "f" ((:) (F_Apl "g" ((:) r_vh ((:) r_va [])))
64 ((:) r_vc []))))) ((:) (F_Def "q" [] (F_Apl "e" ((:) (F_Apl "p" ((:) r_vc
65 ((:) r_vd []))) []))) []))) (F_Apl "e" ((:) r_vq [])))) []))));
66 f_sp::[T_def] -> [Char];
67 f_sp a_ds=f_concat [(++) (f_sd a_d) ";\n"|a_d<-a_ds];
68 f_sd::T_def -> [Char];
69 f_sd (F_Def a_f a_bs a_e)=(++) a_f ((++) (f_concat [(++) " " a_b|a_b<-a_bs]) ((++) " = " (f_se a_e)));
70 f_se::T_expr -> [Char];
71 f_se (F_Apl a_h a_es)=
72 let {
73 r_se'=
74 if (not (f_letter (head a_h)))
75 then ((++) "(" ((++) (f_se ((!!) a_es (0 :: Int))) ((++) a_h ((++)
76 (f_se ((!!) a_es (1 :: Int))) ")"))))
77 else
78 ((++) "(" ((++) a_h ((++) (f_concat [(++) " " (f_se a_e)|a_e<-a_es]) ")")))
79 } in r_se';
80 f_se (F_Cmp a_e a_qs)=(++) "[" ((++) (f_se a_e) ((++) " | " ((++) (tail
81 (f_concat [(++) ";" (f_sq a_q)|a_q<-a_qs])) "]")));
82 f_se (F_Let [] a_e)=f_se a_e;
83 f_se (F_Let a_ds a_e)=(++) "(LET " ((++) (tail (f_concat [(++) ";\n" (f_sd a_d)|a_d<-a_ds]))
84 ((++) " IN " ((++) (f_se a_e) ")")));
85 f_se (F_Cns a_c)=a_c;
86 f_se (F_Var a_v)=a_v;
87 f_indent::[Char] -> [Char];
88 f_indent []=[];
89 f_indent "\n"="\n";
90 f_indent ('\o012':a_cs)=(++) "\n " (f_indent a_cs);
91 f_indent (a_c:a_cs)=(:) a_c (f_indent a_cs);
92 f_sq::T_qual -> [Char];
93 f_sq (F_Gen a_n a_v a_e)=(++) a_v ((++) " <- " (f_se a_e));
94 f_sq (F_Fil a_e)=f_se a_e;
95 f_tp::[T_def] -> [T_def];
96 f_tp a_ds=f_map f_td a_ds;
97 f_td::T_def -> T_def;
98 f_td (F_Def a_f a_bs a_e)=F_Def a_f a_bs (f_te a_e a_f);
99 f_te::T_expr -> T_var -> T_expr;
100 f_te (F_Apl a_h a_es) a_f=F_Apl a_h [f_te a_e a_f|a_e<-a_es];
101 f_te (F_Cmp a_e a_qs) a_f=f_tq (F_Cmp a_e a_qs) (F_Cns "[]") a_f;
102 f_te (F_Let a_ds a_e) a_f=F_Let [F_Def a_d a_bs (f_te a_e a_f)|(F_Def a_d a_bs a_e)<-a_ds] (f_te a_e a_f);
103 f_te (F_Cns a_c) a_f=F_Cns a_c;
104 f_te (F_Var a_v) a_f=F_Var a_v;
105 f_tq::T_expr -> T_expr -> T_var -> T_expr;
106 f_tq (F_Cmp a_e ((F_Gen a_n a_v a_l1):a_qs)) a_l2 a_f=
107 let {
108 r_h=(++) a_f ((++) "_h" (strict_show_i a_n));
109 r_us=(++) a_f ((++) "_l" (strict_show_i a_n));
110 r_us'=(++) a_f ((++) "_t" (strict_show_i a_n));
111 r_vus=F_Var r_us;
112 r_vus'=F_Var r_us'
113 } in F_Let ((:) (F_Def r_h ((:) r_us []) (F_Apl "if" ((:)
114 (F_Apl "null" ((:) r_vus [])) ((:) (f_te a_l2 a_f) ((:) (F_Let ((:)
115 (F_Def a_v [] (F_Apl "hd" ((:) r_vus []))) ((:) (F_Def r_us' [] (F_Apl "tl" ((:) r_vus []))) []))
116 (f_tq (F_Cmp a_e a_qs) (F_Apl r_h ((:) r_vus' [])) a_f)) []))))) []) (F_Apl r_h ((:) (f_te a_l1 a_f) []));
117 f_tq (F_Cmp a_e ((F_Fil a_b):a_qs)) a_l2 a_f=F_Apl "if" ((:) (f_te a_b a_f) ((:) (f_tq (F_Cmp a_e a_qs) a_l2 a_f)
118 ((:) (f_te a_l2 a_f) [])));
119 f_tq (F_Cmp a_e []) a_l2 a_f=F_Apl ":" ((:) (f_te a_e a_f) ((:) (f_te a_l2 a_f) []));
120 f_lp::[T_def] -> [T_def];
121 f_lp a_p=f_concat [f_ld a_d []|a_d<-a_p];
122 f_ld::T_def -> [T_var] -> [T_def];
123 f_ld (F_Def a_f a_bs a_e) a_gs=
124 let {
125 (r_p,r_e')=f_le a_e (f_usort ((++) a_bs a_gs))
126 } in (:) (F_Def a_f a_bs r_e') r_p;
127 f_le::T_expr -> [T_var] -> ([T_def],T_expr);
128 f_le (F_Apl a_h a_es) a_gs=
129 let {
130 r_pes=[f_le a_e a_gs|a_e<-a_es]
131 } in (f_flatmap f_fst r_pes,F_Apl a_h (f_map f_snd r_pes));
132 f_le (F_Cmp a_e a_qs) a_gs=([],F_Cmp a_e a_qs);
133 f_le (F_Let a_ds a_e) a_gs=
134 let {
135 (r_p,r_e')=f_le a_e a_gs;
136 r_ds'=f_concat [f_ld a_d a_gs|a_d<-a_ds];
137 r_cafs=[F_Def a_c [] a_e|(F_Def a_c [] a_e)<-r_ds'];
138 r_funs=f_def_list_remove r_ds' r_cafs;
139 r_names=[a_f|(F_Def a_f a_bs a_e)<-r_funs];
140 r_frees=[f_ud a_d a_gs|a_d<-r_funs];
141 r_calls=[f_ud a_d r_names|a_d<-r_funs];
142 r_xtras=[(a_n,f_map F_Var a_xs)|(a_n,a_xs)<-f_zip2 r_names r_args];
143 r_args=[f_usort ((++) a_fs (f_concat [a_fs'|(a_n',a_fs')<-f_zip2 r_names r_frees,a_c<-a_cs,f_var_equal a_c a_n']))|(a_fs,a_cs)<-f_zip2 r_frees r_calls];
144 r_cafs'=[F_Def a_c [] (f_xe a_e r_xtras)|(F_Def a_c [] a_e)<-r_cafs];
145 r_funs'=[F_Def a_f ((++) a_as a_bs) (f_xe a_e r_xtras)|(a_as,(F_Def a_f a_bs a_e))<-f_zip2 r_args r_funs]
146 } in ((++) r_p r_funs',F_Let r_cafs' (f_xe r_e' r_xtras));
147 f_le (F_Cns a_c) a_gs=([],F_Cns a_c);
148 f_le (F_Var a_v) a_gs=([],F_Var a_v);
149 f_xe::T_expr -> [(T_var,[T_expr])] -> T_expr;
150 f_xe (F_Apl a_h a_es) a_xs=
151 let {
152 f_extend []=[];
153 f_extend ((a_f,a_xs):a_xtra)=
154 if (f_var_equal a_h a_f)
155 then a_xs
156 else
157 (f_extend a_xtra)
158 } in F_Apl a_h ((++) (f_extend a_xs) [f_xe a_e a_xs|a_e<-a_es]);
159 f_xe (F_Cmp a_e a_qs) a_xs=F_Cmp a_e a_qs;
160 f_xe (F_Let a_ds a_e) a_xs=F_Let [F_Def a_d a_bs (f_xe a_e a_xs)|(F_Def a_d a_bs a_e)<-a_ds] (f_xe a_e a_xs);
161 f_xe (F_Cns a_c) a_xs=F_Cns a_c;
162 f_xe (F_Var a_v) a_xs=F_Var a_v;
163 f_up::[T_def] -> [T_var] -> [T_var];
164 f_up a_ds a_vs=f_concat [f_ud a_d a_vs|a_d<-a_ds];
165 f_ud::T_def -> [T_var] -> [T_var];
166 f_ud (F_Def a_f a_bs a_e) a_vs=f_ue a_e (f_var_list_remove a_vs a_bs);
167 f_ue::T_expr -> [T_var] -> [T_var];
168 f_ue (F_Apl a_h a_es) a_vs=f_concat [f_ue a_e a_vs|a_e<-a_es];
169 f_ue (F_Cmp a_e a_qs) a_vs=[];
170 f_ue (F_Let a_ds a_e) a_vs=(++) (f_up a_ds a_vs) (f_ue a_e a_vs);
171 f_ue (F_Cns a_c) a_vs=[];
172 f_ue (F_Var a_v') a_vs=[a_v|a_v<-a_vs,f_var_equal a_v a_v'];
173 f_flatmap::(t1 -> [t2]) -> [t1] -> [t2];
174 f_flatmap a_f []=[];
175 f_flatmap a_f (a_x:a_xs)=(++) (a_f a_x) (f_flatmap a_f a_xs);
176 f_usort::[T_var] -> [T_var];
177 f_usort []=[];
178 f_usort (a_x:a_xs)=(++) (f_usort [a_u|a_u<-a_xs,f_var_less a_u a_x]) ((:) a_x (f_usort [a_u|a_u<-a_xs,f_var_greater a_u a_x]));
179 f_benchmark_main a_n=f_copy (f_sp (f_tp (f_concat (f_take a_n (f_repeat c_prg)))));
180 f_copy []=[];
181 f_copy (a_x:a_xs)=(:) a_x (f_copy a_xs);
182 f_nlines [] a_n=(++) (strict_show_i a_n) "\n";
183 f_nlines ('\o012':a_xs) a_n=f_nlines a_xs (((+) :: (Int -> Int -> Int)) a_n (1 :: Int));
184 f_nlines (a_x:a_xs) a_n=f_nlines a_xs a_n;
185 c_cmp_less::Int;
186 c_cmp_less=((negate) :: (Int -> Int)) (1 :: Int);
187 c_cmp_equal::Int;
188 c_cmp_equal=(0 :: Int);
189 c_cmp_greater::Int;
190 c_cmp_greater=(1 :: Int);
191 f_cmp_c::Char -> Char -> Int;
192 f_cmp_c a_x a_y=((-) :: (Int -> Int -> Int)) (fromEnum a_x) (fromEnum a_y);
193 f_cmp_string::[Char] -> [Char] -> Int;
194 f_cmp_string a_xs a_ys=f_list_cmp f_cmp_c a_xs a_ys;
195 f_cmp_i::Int -> Int -> Int;
196 f_cmp_i a_x a_y=((-) :: (Int -> Int -> Int)) a_x a_y;
197 f_cmp_d::Double -> Double -> Int;
198 f_cmp_d a_x a_y=floor (entier (((-) :: (Double -> Double -> Double)) a_x a_y));
199 f_max_cmp::(t1 -> t1 -> Int) -> [t1] -> t1;
200 f_max_cmp a_cmp a_xs=f_foldl1 (f_max2_cmp a_cmp) a_xs;
201 f_max2_cmp::(t1 -> t1 -> Int) -> t1 -> t1 -> t1;
202 f_max2_cmp a_cmp a_a a_b=
203 if (((>=) :: (Int -> Int -> Bool)) (a_cmp a_a a_b) c_cmp_equal)
204 then a_a
205 else
206 a_b;
207 f_member_cmp::(t1 -> t1 -> Int) -> [t1] -> t1 -> Bool;
208 f_member_cmp a_cmp a_x a_a=f_or (f_map ((.) (flip ((==) :: (Int -> Int -> Bool)) c_cmp_equal) (a_cmp a_a)) a_x);
209 f_min_cmp::(t1 -> t1 -> Int) -> [t1] -> t1;
210 f_min_cmp a_cmp a_xs=f_foldl1 (f_min2_cmp a_cmp) a_xs;
211 f_min2_cmp::(t1 -> t1 -> Int) -> t1 -> t1 -> t1;
212 f_min2_cmp a_cmp a_a a_b=
213 if (((>) :: (Int -> Int -> Bool)) (a_cmp a_a a_b) c_cmp_equal)
214 then a_b
215 else
216 a_a;
217 f_mkset_cmp::(t1 -> t1 -> Int) -> [t1] -> [t1];
218 f_mkset_cmp a_cmp []=[];
219 f_mkset_cmp a_cmp (a_a:a_x)=(:) a_a (f_filter ((.) (flip ((/=) :: (Int -> Int -> Bool)) c_cmp_equal) (a_cmp a_a)) (f_mkset_cmp a_cmp a_x));
220 f_uniqmerge_cmp::(t1 -> t1 -> Int) -> [t1] -> [t1] -> [t1];
221 f_uniqmerge_cmp a_cmp [] a_y=a_y;
222 f_uniqmerge_cmp a_cmp (a_a:a_x) []=(:) a_a a_x;
223 f_uniqmerge_cmp a_cmp (a_a:a_x) (a_b:a_y)=
224 let {
225 r_order=a_cmp a_a a_b
226 } in
227 if (((<) :: (Int -> Int -> Bool)) r_order c_cmp_equal)
228 then ((:) a_a (f_uniqmerge_cmp a_cmp a_x ((:) a_b a_y)))
229 else
230 if (((==) :: (Int -> Int -> Bool)) r_order c_cmp_equal)
231 then ((:) a_a (f_uniqmerge_cmp a_cmp a_x a_y))
232 else
233 ((:) a_b (f_uniqmerge_cmp a_cmp ((:) a_a a_x) a_y));
234 f_uniqsort_cmp::(t1 -> t1 -> Int) -> [t1] -> [t1];
235 f_uniqsort_cmp a_cmp a_x=
236 let {
237 r_n=length a_x;
238 r_n2=((quot) :: (Int -> Int -> Int)) r_n (2 :: Int)
239 } in
240 if (((<=) :: (Int -> Int -> Bool)) r_n (1 :: Int))
241 then a_x
242 else
243 (f_uniqmerge_cmp a_cmp (f_uniqsort_cmp a_cmp (f_take r_n2 a_x)) (f_uniqsort_cmp a_cmp (f_drop r_n2 a_x)));
244 f_merge_cmp::(t1 -> t1 -> Int) -> [t1] -> [t1] -> [t1];
245 f_merge_cmp a_cmp [] a_y=a_y;
246 f_merge_cmp a_cmp (a_a:a_x) []=(:) a_a a_x;
247 f_merge_cmp a_cmp (a_a:a_x) (a_b:a_y)=
248 if (((<=) :: (Int -> Int -> Bool)) (a_cmp a_a a_b) c_cmp_equal)
249 then ((:) a_a (f_merge_cmp a_cmp a_x ((:) a_b a_y)))
250 else
251 ((:) a_b (f_merge_cmp a_cmp ((:) a_a a_x) a_y));
252 f_sort_cmp::(t1 -> t1 -> Int) -> [t1] -> [t1];
253 f_sort_cmp a_cmp a_x=
254 let {
255 r_n=length a_x;
256 r_n2=((quot) :: (Int -> Int -> Int)) r_n (2 :: Int)
257 } in
258 if (((<=) :: (Int -> Int -> Bool)) r_n (1 :: Int))
259 then a_x
260 else
261 (f_merge_cmp a_cmp (f_sort_cmp a_cmp (f_take r_n2 a_x)) (f_sort_cmp a_cmp (f_drop r_n2 a_x)));
262 f_list_cmp::(t1 -> t1 -> Int) -> [t1] -> [t1] -> Int;
263 f_list_cmp a_cmp [] []=c_cmp_equal;
264 f_list_cmp a_cmp [] a_ys=c_cmp_less;
265 f_list_cmp a_cmp a_xs []=c_cmp_greater;
266 f_list_cmp a_cmp (a_x:a_xs) (a_y:a_ys)=
267 let {
268 r_order=a_cmp a_x a_y
269 } in
270 if (((==) :: (Int -> Int -> Bool)) r_order c_cmp_equal)
271 then (f_list_cmp a_cmp a_xs a_ys)
272 else
273 r_order;
274 f_remove_cmp::(t1 -> t1 -> Int) -> [t1] -> [t1] -> [t1];
275 f_remove_cmp a_cmp a_xs []=a_xs;
276 f_remove_cmp a_cmp a_xs (a_y:a_ys)=
277 let {
278 f_remove' a_y []=[];
279 f_remove' a_y (a_x:a_xs)=
280 if (((==) :: (Int -> Int -> Bool)) (a_cmp a_x a_y) c_cmp_equal)
281 then a_xs
282 else
283 ((:) a_x (f_remove' a_y a_xs))
284 } in f_remove_cmp a_cmp (f_remove' a_y a_xs) a_ys;
285 f_cmp_combine::[Int] -> Int;
286 f_cmp_combine []=c_cmp_equal;
287 f_cmp_combine (a_x:a_xs)=
288 if (((==) :: (Int -> Int -> Bool)) a_x c_cmp_equal)
289 then (f_cmp_combine a_xs)
290 else
291 a_x;
292 f_abs::Double -> Double;
293 f_abs a_x=
294 if (((<=) :: (Double -> Double -> Bool)) a_x (0.00000 :: Double))
295 then (((negate) :: (Double -> Double)) a_x)
296 else
297 a_x;
298 f_and::[Bool] -> Bool;
299 f_and a_xs=f_foldr (&&) True a_xs;
300 f_cjustify::Int -> [Char] -> [Char];
301 f_cjustify a_n a_s=
302 let {
303 r_margin=((-) :: (Int -> Int -> Int)) a_n (length a_s);
304 r_lmargin=((quot) :: (Int -> Int -> Int)) r_margin (2 :: Int);
305 r_rmargin=((-) :: (Int -> Int -> Int)) r_margin r_lmargin
306 } in (++) (f_spaces r_lmargin) ((++) a_s (f_spaces r_rmargin));
307 f_concat::[[t1]] -> [t1];
308 f_concat a_xs=f_foldr (++) [] a_xs;
309 f_const::t1 -> t2 -> t1;
310 f_const a_x a_y=a_x;
311 f_digit::Char -> Bool;
312 f_digit a_x=
313 if (((<=) :: (Int -> Int -> Bool)) (fromEnum '0') (fromEnum a_x))
314 then (((<=) :: (Int -> Int -> Bool)) (fromEnum a_x) (fromEnum '9'))
315 else
316 False;
317 f_drop::Int -> [t1] -> [t1];
318 f_drop 0 a_x=a_x;
319 f_drop a_n (a_a:a_x)=f_drop (((-) :: (Int -> Int -> Int)) a_n (1 :: Int)) a_x;
320 f_drop a_n a_x=[];
321 f_dropwhile::(t1 -> Bool) -> [t1] -> [t1];
322 f_dropwhile a_f []=[];
323 f_dropwhile a_f (a_a:a_x)=
324 if (a_f a_a)
325 then (f_dropwhile a_f a_x)
326 else
327 ((:) a_a a_x);
328 c_e::Double;
329 c_e=((exp) :: (Double -> Double)) (1.00000 :: Double);
330 f_filter::(t1 -> Bool) -> [t1] -> [t1];
331 f_filter a_f a_x=[a_a|a_a<-a_x,a_f a_a];
332 f_foldl::(t1 -> t2 -> t1) -> t1 -> [t2] -> t1;
333 f_foldl a_op a_r []=a_r;
334 f_foldl a_op a_r (a_a:a_x)=
335 let {
336 f_strict a_f a_x=miraseq a_x (a_f a_x)
337 } in f_foldl a_op (f_strict a_op a_r a_a) a_x;
338 f_foldl1::(t1 -> t1 -> t1) -> [t1] -> t1;
339 f_foldl1 a_op (a_a:a_x)=f_foldl a_op a_a a_x;
340 f_foldr::(t1 -> t2 -> t2) -> t2 -> [t1] -> t2;
341 f_foldr a_op a_r []=a_r;
342 f_foldr a_op a_r (a_a:a_x)=a_op a_a (f_foldr a_op a_r a_x);
343 f_foldr1::(t1 -> t1 -> t1) -> [t1] -> t1;
344 f_foldr1 a_op (a_a:[])=a_a;
345 f_foldr1 a_op (a_a:a_b:a_x)=a_op a_a (f_foldr1 a_op ((:) a_b a_x));
346 f_fst::(t1,t2) -> t1;
347 f_fst (a_a,a_b)=a_a;
348 f_id::t1 -> t1;
349 f_id a_x=a_x;
350 f_index::[t1] -> [Int];
351 f_index a_x=
352 let {
353 f_f a_n []=[];
354 f_f a_n (a_a:a_x)=(:) a_n (f_f (((+) :: (Int -> Int -> Int)) a_n (1 :: Int)) a_x)
355 } in f_f (0 :: Int) a_x;
356 f_init::[t1] -> [t1];
357 f_init (a_a:a_x)=
358 if (null a_x)
359 then []
360 else
361 ((:) a_a (f_init a_x));
362 f_iterate::(t1 -> t1) -> t1 -> [t1];
363 f_iterate a_f a_x=(:) a_x (f_iterate a_f (a_f a_x));
364 f_last::[t1] -> t1;
365 f_last a_x=(!!) a_x (((-) :: (Int -> Int -> Int)) (length a_x) (1 :: Int));
366 f_lay::[[Char]] -> [Char];
367 f_lay []=[];
368 f_lay (a_a:a_x)=(++) a_a ((++) "\n" (f_lay a_x));
369 f_layn::[[Char]] -> [Char];
370 f_layn a_x=
371 let {
372 f_f a_n []=[];
373 f_f a_n (a_a:a_x)=(++) (f_rjustify (4 :: Int) (strict_show_i a_n)) ((++) ") " ((++) a_a ((++) "\n"
374 (f_f (((+) :: (Int -> Int -> Int)) a_n (1 :: Int)) a_x))))
375 } in f_f (1 :: Int) a_x;
376 f_letter::Char -> Bool;
377 f_letter a_c=
378 if (
379 if (((<=) :: (Int -> Int -> Bool)) (fromEnum 'a') (fromEnum a_c))
380 then (((<=) :: (Int -> Int -> Bool)) (fromEnum a_c) (fromEnum 'z'))
381 else
382 False)
383 then True
384 else
385 if (((<=) :: (Int -> Int -> Bool)) (fromEnum 'A') (fromEnum a_c))
386 then (((<=) :: (Int -> Int -> Bool)) (fromEnum a_c) (fromEnum 'Z'))
387 else
388 False;
389 f_limit::[Double] -> Double;
390 f_limit (a_a:a_b:a_x)=
391 if (((==) :: (Double -> Double -> Bool)) a_a a_b)
392 then a_a
393 else
394 (f_limit ((:) a_b a_x));
395 f_lines::[Char] -> [[Char]];
396 f_lines []=[];
397 f_lines (a_a:a_x)=
398 let {
399 r_xs=
400 if (pair a_x)
401 then (f_lines a_x)
402 else
403 ((:) [] [])
404 } in
405 if (((==) :: (Int -> Int -> Bool)) (fromEnum a_a) (fromEnum '\o012'))
406 then ((:) [] (f_lines a_x))
407 else
408 ((:) ((:) a_a (head r_xs)) (tail r_xs));
409 f_ljustify::Int -> [Char] -> [Char];
410 f_ljustify a_n a_s=(++) a_s (f_spaces (((-) :: (Int -> Int -> Int)) a_n (length a_s)));
411 f_map::(t1 -> t2) -> [t1] -> [t2];
412 f_map a_f a_x=[a_f a_a|a_a<-a_x];
413 f_map2::(t1 -> t2 -> t3) -> [t1] -> [t2] -> [t3];
414 f_map2 a_f a_x a_y=[a_f a_a a_b|(a_a,a_b)<-f_zip2 a_x a_y];
415 f_max::[Int] -> Int;
416 f_max a_xs=f_foldl1 f_max2 a_xs;
417 f_max2::Int -> Int -> Int;
418 f_max2 a_a a_b=
419 if (((>=) :: (Int -> Int -> Bool)) a_a a_b)
420 then a_a
421 else
422 a_b;
423 f_member::[Int] -> Int -> Bool;
424 f_member a_x a_a=f_or (f_map (flip ((==) :: (Int -> Int -> Bool)) a_a) a_x);
425 f_merge::[Int] -> [Int] -> [Int];
426 f_merge [] a_y=a_y;
427 f_merge (a_a:a_x) []=(:) a_a a_x;
428 f_merge (a_a:a_x) (a_b:a_y)=
429 if (((<=) :: (Int -> Int -> Bool)) a_a a_b)
430 then ((:) a_a (f_merge a_x ((:) a_b a_y)))
431 else
432 ((:) a_b (f_merge ((:) a_a a_x) a_y));
433 f_min::[Int] -> Int;
434 f_min a_xs=f_foldl1 f_min2 a_xs;
435 f_min2::Int -> Int -> Int;
436 f_min2 a_a a_b=
437 if (((>) :: (Int -> Int -> Bool)) a_a a_b)
438 then a_b
439 else
440 a_a;
441 f_mkset::[Int] -> [Int];
442 f_mkset []=[];
443 f_mkset (a_a:a_x)=(:) a_a (f_filter (flip ((/=) :: (Int -> Int -> Bool)) a_a) (f_mkset a_x));
444 f_or::[Bool] -> Bool;
445 f_or a_xs=f_foldr (||) False a_xs;
446 c_pi::Double;
447 c_pi=((*) :: (Double -> Double -> Double)) (4.00000 :: Double) (((atan) :: (Double -> Double)) (1.00000 :: Double));
448 f_postfix::t1 -> [t1] -> [t1];
449 f_postfix a_a a_x=(++) a_x ((:) a_a []);
450 f_product::[Int] -> Int;
451 f_product a_xs=f_foldl ((*) :: (Int -> Int -> Int)) (1 :: Int) a_xs;
452 f_rep::Int -> t1 -> [t1];
453 f_rep a_n a_x=f_take a_n (f_repeat a_x);
454 f_repeat::t1 -> [t1];
455 f_repeat a_x=(:) a_x (f_repeat a_x);
456 f_reverse::[t1] -> [t1];
457 f_reverse a_xs=f_foldl (flip (:)) [] a_xs;
458 f_rjustify::Int -> [Char] -> [Char];
459 f_rjustify a_n a_s=(++) (f_spaces (((-) :: (Int -> Int -> Int)) a_n (length a_s))) a_s;
460 f_scan::(t1 -> t2 -> t1) -> t1 -> [t2] -> [t1];
461 f_scan a_op=
462 let {
463 f_g a_r []=(:) a_r [];
464 f_g a_r (a_a:a_x)=(:) a_r (f_g (a_op a_r a_a) a_x)
465 } in f_g;
466 f_snd::(t1,t2) -> t2;
467 f_snd (a_a,a_b)=a_b;
468 f_sort::[Int] -> [Int];
469 f_sort a_x=
470 let {
471 r_n=length a_x;
472 r_n2=((quot) :: (Int -> Int -> Int)) r_n (2 :: Int)
473 } in
474 if (((<=) :: (Int -> Int -> Bool)) r_n (1 :: Int))
475 then a_x
476 else
477 (f_merge (f_sort (f_take r_n2 a_x)) (f_sort (f_drop r_n2 a_x)));
478 f_spaces::Int -> [Char];
479 f_spaces a_n=f_rep a_n ' ';
480 f_subtract::Int -> Int -> Int;
481 f_subtract a_x a_y=((-) :: (Int -> Int -> Int)) a_y a_x;
482 f_sum::[Int] -> Int;
483 f_sum a_xs=f_foldl ((+) :: (Int -> Int -> Int)) (0 :: Int) a_xs;
484 data
485 T_sys_message=F_Stdout [Char] | F_Stderr [Char] | F_Tofile [Char] [Char] | F_Closefile [Char] | F_Appendfile [Char] | F_System [Char] | F_Exit Int;
486 f_take::Int -> [t1] -> [t1];
487 f_take 0 a_x=[];
488 f_take a_n (a_a:a_x)=(:) a_a (f_take (((-) :: (Int -> Int -> Int)) a_n (1 :: Int)) a_x);
489 f_take a_n a_x=[];
490 f_takewhile::(t1 -> Bool) -> [t1] -> [t1];
491 f_takewhile a_f []=[];
492 f_takewhile a_f (a_a:a_x)=
493 if (a_f a_a)
494 then ((:) a_a (f_takewhile a_f a_x))
495 else
496 [];
497 f_transpose::[[t1]] -> [[t1]];
498 f_transpose a_x=
499 let {
500 r_x'=f_takewhile pair a_x
501 } in
502 if (null r_x')
503 then []
504 else
505 ((:) (f_map head r_x') (f_transpose (f_map tail r_x')));
506 f_until::(t1 -> Bool) -> (t1 -> t1) -> t1 -> t1;
507 f_until a_f a_g a_x=
508 if (a_f a_x)
509 then a_x
510 else
511 (f_until a_f a_g (a_g a_x));
512 f_zip2::[t1] -> [t2] -> [(t1,t2)];
513 f_zip2 (a_a:a_x) (a_b:a_y)=(:) (a_a,a_b) (f_zip2 a_x a_y);
514 f_zip2 a_x a_y=[];
515 f_zip3 (a_a:a_x) (a_b:a_y) (a_c:a_z)=(:) (a_a,a_b,a_c) (f_zip3 a_x a_y a_z);
516 f_zip3 a_x a_y a_z=[];
517 f_zip4 (a_a:a_w) (a_b:a_x) (a_c:a_y) (a_d:a_z)=(:) (a_a,a_b,a_c,a_d) (f_zip4 a_w a_x a_y a_z);
518 f_zip4 a_w a_x a_y a_z=[];
519 f_zip5 (a_a:a_v) (a_b:a_w) (a_c:a_x) (a_d:a_y) (a_e:a_z)=(:) (a_a,a_b,a_c,a_d,a_e) (f_zip5 a_v a_w a_x a_y a_z);
520 f_zip5 a_v a_w a_x a_y a_z=[];
521 f_zip6 (a_a:a_u) (a_b:a_v) (a_c:a_w) (a_d:a_x) (a_e:a_y) (a_f:a_z)=(:) (a_a,a_b,a_c,a_d,a_e,a_f) (f_zip6 a_u a_v a_w a_x a_y a_z);
522 f_zip6 a_u a_v a_w a_x a_y a_z=[];
523 f_zip::([t1],[t2]) -> [(t1,t2)];
524 f_zip (a_x,a_y)=f_zip2 a_x a_y;
525 f_main a_x=f_benchmark_main a_x;
526 main = do
527 [n] <- getArgs
528 print (length (f_main (read n)))
529 }