heist :: (Num n) => [n] -> [n] -> n -> n
-- heist [] [] _ = 0
heist w v maxw = func w v i j where
i = length w
j = maxw
func :: (Num n) => [n] -> [n] -> n -> n -> n
func _ _ 0 0 = 0
the above code is giving me:
Heist.hs:15:27:
Could not deduce (n ~ Int)
from the context (Num n)
bound by the type signature for
heist :: Num n => [n] -> [n] -> n -> n
at Heist.hs:(15,1)-(17,16)
`n' is a rigid type variable bound by
the type signature for heist :: Num n => [n] -> [n] -> n -> n
at Heist.hs:15:1
In the third argument of `func', namely `i'
In the expression: func w v i j
In an equation for `heist':
heist w v maxw
= func w v i j
where
i = length w
j = maxw
Why is that happening?
I am wrapping my head around Haskell type system inch by inch