
On Sun, Jun 18, 2017 at 05:02:13PM +0800, Choi Waikit wrote:
Hi guys,
I have difficulty understanding how GHC determines what kind of error message to return. Could you help explain a bit ? Thanks !
The code can be accessed here http://lpaste.net/356325
My question is Why does calling `settleDown 9` return different error message from `settleDown "sting"` ?
Hello David, every time you write a number in a haskell source, it gets automagically wrapped in `fromInteger` (actually, `fromInteger` if there isn't a dot, `fromRational` otherwise). This is made to provide some kind of overloading. `fromInteger` has signature: λ> :t fromInteger fromInteger :: Num a => Integer -> a hence the different error with 9 and "string"! Is it clear now?