
| I feel that it must be somewhat related to this behaviour: | | Prelude> :t show . read | show . read :: String -> String | Prelude> (show . read) " 13213 " | "13213" | Prelude> (show . read) " 0x10000 " | "65536" | Prelude> (show . read) " 10000.0 " | "*** Exception: Prelude.read: no parse | | For some reason GHC defaults to Integer, even when monomorphism | restriction doesn't come into play. This is all quite reasonable. The defaulting rule says precisely what should happen. When there is an ambiguous constraint, (Show a, Read a) in this case, the defaulting rules say to try Integer and then Int (unless you have a default declaration). In this case Integer works. | Hugs chooses this funny, but IMHO more correct, type: | | Prelude> :t show . read | show . read :: (Read a, Show a) => [Char] -> [Char] It's no more correct, because it's ambiguous. Every call to (show . read) will give rise to an ambiguous constraint, which will be resolved in the same way. GHC just does it a little earlier. Simon