Given two different types T1 and T2, it's possible to have two different results of

> let {x :: T1; x = read s} in show x

and

> let {x :: T2; x = read s} in show x

so that neither of two "read"s fails. For example

> let {x :: Int; x = read "1000000000000"} in show x

produces the answer "-727379968".

BTW, I'd love to be able to give default instances locally, so that something like

> main = withdef Read Int {putStrLn $ show $ read "1000000000000"}

would typecheck successfully.

On 7 Dec 2008, at 16:11, John Ky wrote:

Hi,

Is there a way to read Showables?

main = do
    putStrLn $ show $ read

Thanks

-John

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to