I can write
double :: Int -> Float
double i = 2.0
but that isn't in any way a function of its argument. Casting is apparently forbidden, mixed-mode arithmetic isn't supported, so I can't do anything like
double :: Int -> Float
double i = 2.0 * i
I'm actually trying to figure out how to define
series :: (Int -> Float) -> Int -> [Float]
to return the infinite series [f(i), f(i+1), f(i+2),...] but I'm stuck at computing f(i).
If this is really impossible, what type must I use?
Thanks!
I think you're looking for the fromIntegral function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With