
3 Nov
2004
3 Nov
'04
4:06 a.m.
On Tue, 2 Nov 2004, Marc Charpentier wrote:
Doing some calculations in ghci, I encountered a difficulty which I cannot resolve.
Here's a distilled version, prepared for the command line:
let i = 2 in (-1)^i/(2^(10*i)) * (-2^5/(4*i+1))
Monomorphism was the short answer, the long one is: Written this way 'i' must have the same type at each occurence. But (^i) requires some Integral type for i and (/i) requires some fractional type for i, I guess there is no such type. You can resolve this problem also by an explicit conversion: (-2^5/(4 * fromIntegral i + 1)) But this still leaves the interpreter uncertain, what Integral type to use, so you might want to give an explicit signature: let i = 2 :: Integer in ...