0
votes

This is the code of my program:

funct :: Double -> Double
funct x = 3/(x^2+1)

zetaRange :: (Int, Int) -> [Double]
zetaRange (x,y) = [ 0.01 * funct n | n <- [x..y] ]

and error, which I'm getting:

Couldn't match expected type ‘Double’ with actual type ‘Int’

In the first argument of ‘funct’, namely ‘n’

In the second argument of ‘(*)’, namely ‘funct n’

I really newbie to haskell, so trying to fix this error wasn't successful. funct is returning Double, so I can't understand why error says that it's actual type is Int. Please, help!

1
Why is this tagged with "multithreading"? The question has nothing to do with multithreading.Rein Henrichs
Wait. Aren't you the same user that asked two question about Haskell and concurrency? Your user name is eerily familiarZeta
It says in the first argument of 'funct'. Not in the return type!user253751

1 Answers

4
votes

You need to convert the Int n to a Double:

zetaRange (x,y) = [ 0.01 * funct (fromIntegral n) | n <- [x..y] ]