0
votes

I am having this interpretation error which I do not know what is wrong

module Series where

series :: Double -> Double
series i1 = zipWith (/) (map (i1^)[1..]) (map(\x -> product[1..x]) [1..])

The error I have is

Couldn't match expected type `Double' with actual type `[c0]'
    In the return type of a call of `zipWith'
    In the expression:
      zipWith
        (/) (map (i1 ^) [1 .. ]) (map (\ x -> product [1 .. x]) [1 .. ])
    In an equation for `series':
        series i1
          = zipWith
              (/) (map (i1 ^) [1 .. ]) (map (\ x -> product [1 .. x]) [1 .. ])
Failed, modules loaded: none.

Anyone can help? Thanks in advance!

1
Result type of zipWith is a List.arrowd
OH! haha ok got it running! thanks!kkh

1 Answers

3
votes

It's easy to find the answer by yourself with ghci:

> let series i1 = zipWith (/) (map (i1^)[1..]) (map(\x -> product[1..x]) [1..])

> :t series 
series :: (Enum c, Fractional c) => c -> [c]

I do not know what is wrong

Your signature is wrong and compiler cannot match actual function type with your one.