[Haskell-cafe] Reading showables

John Ky newhoggy at gmail.com
Sun Dec 7 19:16:10 EST 2008


Hi Thomas,

So "show . read" and "\x -> show (read x)" are actually mean different
things?

Also, I never suspected that something like this should succeed:

putStrLn $ (read . show) $ "!@#%$^DFD"

Thanks,

-John

On Mon, Dec 8, 2008 at 12:38 AM, Thomas Hartman <tphyahoo at gmail.com> wrote:

> John,
>
>  By convention, read . show is supposed to be id.
>
>  However, in real life, this is often not the case. It all depends on
> the implementor, and this is a convention that seems to be broken
> pretty frequently.
>
>  Often there is a show instance with no read or vice versa, and
> sometimes even when there is both read and show they are not inverses.
>
>  Thomas.
>
> main = show . read
>
>
>
> Am 7. Dezember 2008 14:11 schrieb John Ky <newhoggy at gmail.com>:
> > Hi,
> >
> > Is there a way to read Showables?
> >
> > main = do
> >     putStrLn $ show $ read
> >
> > Thanks
> >
> > -John
> >
> >
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081208/861adb18/attachment-0001.htm


More information about the Haskell-Cafe mailing list