当我尝试使用ghci加载我的代码时,它给了我这个错误:
Asig1.hs:4:1:
Non type-variable argument in the constraint: Num [c]
(Use FlexibleContexts to permit this)
When checking that ‘f’ has the inferred type
f :: forall c (t :: * -> *).
(Num c, Num [c], Foldable t) =>
[c] -> [c] -> t [c] -> ([c], [c])
Run Code Online (Sandbox Code Playgroud)
我不明白我做错了什么.这是我的代码:
module Asig1 where
f as ys x = (s,z)
where
ws = zipWith (*) as ys
s = foldl (+) ws x
z = s
Run Code Online (Sandbox Code Playgroud)