您好我能不知道這一點我自己,我也不能在網上找到一個也許,只是更多然後3個變量
我試圖用一個也許一個例子或保護和實例我發現只有兩個變量, 當我編輯或下面的例子中有兩個以上我得到下面有一個錯誤就是我試圖做
--maybe example
Fun :: Double -> Double -> Double -> Maybe Double
Fun a b c
| a >= -1.0 || a <= 1.0 || b >= -1.0 || b <=1.0 || c /=0 || c >= -1.0 = Nothing
| otherwise = Just max( ((c^ (-c)) + (a^(-c)-1.0)^ (a+ (-1.0/a))) 0.0)
誤差GCHI
The function `Just' is applied to two arguments,
but its type `a0 -> Maybe a0' has only one
情況H lint會給出
No suggestions
試圖用一個後衛,而不是我得到一個不同的錯誤
--guard example
Fun :: Double -> Double -> Double -> Maybe Double
Fun a b c
| a >= -1.0 || a <= 1.0 || b >= -1.0 || b <=1.0 || c /=0 || c >= -1.0 = error "Value out of range "
| otherwise = max( ((c^ (-c)) + (a^(-c)-1.0)^ (a+ (-1.0/a))) 0.0)
和繼承人GHC和hlints錯誤
test.hs:10:1:
Invalid type signature: Fun :: Double
-> Double -> Double -> Maybe Double
Should be of form <variable> :: <type>
$ hlint test.hs
Error message:
Left-hand side of type signature is not a variable: Fun
Code:
Fun :: Double -> Double -> Double -> Maybe Double
> Fun a b c
'樂趣'應該是一個函數,'樂趣',不是? –