我正在尝试创建一个函数,该函数将给定列表中的所有数字相加,然后将其除以6。
average :: [Integer] -> Integer
average m = (sum m) quot 6
但这是我收到的错误消息:
Couldn't match type `Integer'
with `(a0 -> a0 -> a0) -> a1 -> Integer'
Expected type: [(a0 -> a0 -> a0) -> a1 -> Integer]
Actual type: [Integer]
In the first argument of `sum', namely `m'
In the expression: (sum m) quot 6
您需要在quot
两边加上反号,或者先写
sum m `quot` 6
quot (sum m) 6