
13 Jun
2004
13 Jun
'04
7:04 a.m.
Am 13.06.2004 um 12:25 schrieb Lauri Alanko:
Why do you have all those type annotations? Simply writing directly:
fac n = product [1..n] term x n = -1 ** n * (x ** (2 * n + 1)) / fac (2 * n + 1)
gives you functions for which are inferred the types (which you can of course also give explicitly if you want):
fac :: (Enum a, Num a) => a -> a term :: (Floating a, Enum a) => a -> a -> a
I didn't expect it to be that easy! Thank you for your detailed answer. I think, I just didn't expect [1..3.4] to work, but it actually does! And I see, I really have to give chapter 12.4 in HSoE a closer look... Chris