[haskell] - не работает пример
От: 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.


Взял отсюда http://learnyouahaskell.com/recursion

Самое неприятное, что я пока не научился понимать, на что он вообще ругается.
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.