hpaste1
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
| import Data.List (foldl')
main = print wtf11
wtf1 = max' [1..10^9] `seq` ()
wtf1u () = max' [1..10^9] `seq` ()
wtf1' = const () $! max' [1..10^9]
wtf1'u () = const () $! max' [1..10^9]
wtf2 = sum' [1..10^9] `seq` ()
wtf2u () = sum' [1..10^9] `seq` ()
wtf2' = const () $! sum' [1..10^9]
wtf2'u () = const () $! sum' [1..10^9]
wtf3 = sum'' [1..10^9] `seq` ()
wtf3u () = sum'' [1..10^9] `seq` ()
wtf3' = const () $! sum'' [1..10^9]
wtf3'u () = const () $! sum'' [1..10^9]
wtf4 = last [1..10^9] `seq` ()
wtf5 = last (take (10^9) (repeat 1)) `seq` ()
wtf5' = const () $! (last $ take (10^9) $ repeat 1)
wtf6 = last (take (10^9) (repeat ())) `seq` ()
wtf7 = last (take (10^9) (repeat 'z')) `seq` ()
wtf7' = const () $! last (take (10^9) (repeat 'z'))
wtf8 = last (take (10^9) (repeat undefined)) `seq` ()
wtf8' = const () $! last (take (10^9) (repeat undefined))
wtf9 = last (take (10^9) (repeat Wtf)) `seq` ()
wtf10 = last (take (10^9) (repeat id)) `seq` ()
wtf11 = last (repeat ()) `seq` ()
wtf12 = last (map id (repeat ())) `seq` ()
wtf13 = last (repeat 1) `seq` ()
wtf14 = last (map id (repeat 1)) `seq` ()
wtf15 = last (repeat Wtf) `seq` ()
wtf16 = last (map id (repeat Wtf)) `seq` ()
data Wtf = Wtf
max' :: [Int] -> Int
max' = foldl' max 0
sum' :: [Int] -> Int
sum' = foldl' (+) 0
sum'' :: [Int] -> Int
sum'' = f 0
where f z [] = z
f z (x:xs) = let z' = z + x in z' `seq` f z' xs |
11:1: Warning: Use camelCase
Found:
wtf1'u () = ...
Why not:
wtf1U () = ...
17:1: Warning: Use camelCase
Found:
wtf2'u () = ...
Why not:
wtf2U () = ...
23:1: Warning: Use camelCase
Found:
wtf3'u () = ...
Why not:
wtf3U () = ...
27:14: Error: Use replicate
Found:
take (10 ^ 9) (repeat 1)
Why not:
replicate (10 ^ 9) 1
28:9: Warning: Redundant $
Found:
const () $! (last $ take (10 ^ 9) $ repeat 1)
Why not:
const () $! last (take (10 ^ 9) $ repeat 1)
28:29: Error: Use replicate
Found:
take (10 ^ 9) $ repeat 1
Why not:
replicate (10 ^ 9) 1
30:14: Error: Use replicate
Found:
take (10 ^ 9) (repeat ())
Why not:
replicate (10 ^ 9) ()
39:15: Error: Use replicate
Found:
take (10 ^ 9) (repeat 'z')
Why not:
replicate (10 ^ 9) 'z'
40:27: Error: Use replicate
Found:
take (10 ^ 9) (repeat 'z')
Why not:
replicate (10 ^ 9) 'z'
42:15: Error: Use replicate
Found:
take (10 ^ 9) (repeat undefined)
Why not:
replicate (10 ^ 9) undefined
43:27: Error: Use replicate
Found:
take (10 ^ 9) (repeat undefined)
Why not:
replicate (10 ^ 9) undefined
45:14: Error: Use replicate
Found:
take (10 ^ 9) (repeat Wtf)
Why not:
replicate (10 ^ 9) Wtf
47:15: Error: Use replicate
Found:
take (10 ^ 9) (repeat id)
Why not:
replicate (10 ^ 9) id