, 나는이 시도. 나는 하스켈하는 초보자입니다반복 기능 N 시간 오류 하스켈
[1 of 1] Compiling Main (pad.hs, interpreted)
pad.hs:2:8:
Could not deduce (Eq n) arising from the literal `0'
from the context (Num n)
bound by the type signature for
multi :: Num n => n -> (a -> a) -> a -> a
at pad.hs:1:8-35
Possible fix:
add (Eq n) to the context of
the type signature for multi :: Num n => n -> (a -> a) -> a -> a
In the pattern: 0
In an equation for `multi': multi 0 f x = x
pad.hs:3:23:
Could not deduce (Num ((a -> a) -> a -> a))
arising from a use of `-'
from the context (Num n)
bound by the type signature for
multi :: Num n => n -> (a -> a) -> a -> a
at pad.hs:1:8-35
Possible fix:
add an instance declaration for (Num ((a -> a) -> a -> a))
In the expression: multi n - 1
In the expression: (multi n - 1) f (f x)
In an equation for `multi': multi n f x = (multi n - 1) f (f x)
Failed, modules loaded: none.
: 는 ghci에서 나는 이것을 얻었다. 나는 무엇을해야합니까?
매우 간단합니다. 다른 질문은 코드에 포함되어 있지만 'n-1'대신 '(n-1)'을 사용한다고 명시 적으로 말한 유일한 사람입니다. – PyRulez