![]() |
От: | DemAS | http://demas.me |
Дата: | 30.10.09 08:12 | ||
Оценка: |
maximum2 :: (Ord a) => [a] -> a
maximum2 [] = error "maximum of empty list"
maximum2 [x] = x
maximum2 [x:xs]
| x > maxTail = x
| otherwise = maxTail
where maxTail = maximum2 xs
Prelude> :load test1.hs
[1 of 1] Compiling Main ( test1.hs, interpreted )
test1.hs:90:0:
Occurs check: cannot construct the infinite type: a = [a]
When generalising the type(s) for `maximum2'
Failed, modules loaded: none.