Because this works
Prelude> read "2.3" + 1.0
3.3
Seriously I can only assume that via the inference it decides based on the
one that the string must be of type Int and uses the Read instance of Int
to parse it; whereas that string is obviously a float.
That is what* I think* it does.
On Thu, Apr 5, 2012 at 4:16 PM, 
Hello.
Consider the following ghci session:
Prelude> :t read "2" + 1 read "2" + 1 :: (Num a, Read a) => a
Prelude> :t read "2.3" + 1 read "2.3" + 1 :: (Num a, Read a) => a
Prelude> read "2" + 1 3
Prelude> read "2.3" + 1 *** Exception: Prelude.read: no parse
Why does (read "2" + 1) works, but (read "2.3" + 1) fail at runtime?
Romildo
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
-- Google+: https://plus.google.com/111881868112036203454