
Hi all, consider this very small function: thing n = n + round(sqrt n) It loads into ghci with no warnings. When I try to run "thing 10" I get: *Main> :load c:\temp\statictype.hs [1 of 1] Compiling Main ( C:\temp\statictype.hs, interpreted ) Ok, modules loaded: Main. *Main> thing 10 <interactive>:1:0: Ambiguous type variable `t' in the constraints: `Integral t' arising from a use of `thing' at <interactive>:1:0-7 `RealFrac t' arising from a use of `thing' at <interactive>:1:0-7 `Floating t' arising from a use of `thing' at <interactive>:1:0-7 Probable fix: add a type signature that fixes these type variable(s) I have tried to add various type signatures (without really knowing what I'm doing!) and haven't been able to get it to work. I am confused about a few things related to this: (a) what type signature fixes it and why it needs any help - it looks like the sort of thing that type inference shouldn't need any help with (b) it looks like a runtime type error and I thought you didn't get runtime type errors in Haskell (c) if I substitute 10 for n and do "10 + round(sqrt 10)" I get the expected answer 13 any help most welcome. cheers, Ivan