IO behaves oddly if used nested

John Meacham john at repetae.net
Sat Oct 4 22:00:47 EDT 2003


it might be more clear if IO had a show instance like

instance (Typeable b) => Show (IO b) where 
    show (x:: IO a) = "<< IO action producing a " ++ (show $ typeOf (undefined :: a)) ++ " >>"

then print $ getChar prints << IO action producing a Char >>

of course this may not be feasable for all implemenations if they don't
autoderive Typeable...
        John

-- 
---------------------------------------------------------------------------
John Meacham - California Institute of Technology, Alum. - john at foo.net
---------------------------------------------------------------------------


More information about the Haskell-Cafe mailing list