main =
let result = 2 `div` 0
in print result
main =
let result = 2 `div` 0
in putStr "Bye!"
main =
let cx = 2 / 6.054
nk = 4 * 12.003
coeffs = [cx, nk]
in putStr "Nothing..."
main =
let cx = 2 / 6.054
nk = 4 * 12.003
coeffs = [cx, nk]
in print $ length coeffs
main =
let cx = 2 / 6.054
nk = 4 * 12.003
coeffs = [cx, nk]
in print $ coeffs !! 1
main =
let cx = 2 / 6.054
nk = 4 * 12.003
coeffs = [cx, nk]
in print coeffs
main =
let evens = [2, 4 .. 100]
in print $ take 10 evens
main =
let evens = [2, 4 ..]
in print $ take 10 evens
(?) :: Bool -> (a, a) -> a
True ? (f, _) = f
False ? (_, s) = s
main = do
putStr "Input URL prefix: "
prefix <- getLine
(prefix == "https") ?
(putStr "Secure web!",
exitFailure)
main =
let result = 2 `div` 0
in putStr "Bye!"
bad :: Num b => [a] -> b -> b
bad [] c = c
bad (_:xs) c = bad xs $ c + 1
bad [1,2,3] 0
bad 1:[2,3] 0 + 1
bad 1:2:[3] (0 + 1) + 1
bad 1:2:3:[] ((0 + 1) + 1) + 1
((0 + 1) + 1) + 1 = 3
main =
print $ bad [1..50000000] 0
-O0 | -O2 | |
---|---|---|
63 c | 3.2 с | |
6.4 ГБ | 104 кБ | |
ok :: Num b => [a] -> b -> b
ok [] c = c
ok (_:xs) c = ok xs $! c + 1
Лениво | Строго | |
---|---|---|
63 c | 5.8 с | |
6.4 ГБ | 182 кБ | |