At 2001-08-16 13:30, Mark Carroll wrote:
>in ghci,
>
>let x = readFile "/tmp/foo"
x here has type "IO String"
>putStr x
putStr wants x to be type "String". You want this:
do
{
x <- readFile "/tmp/foo";
putStr x;
}
...which is translated to...
readFile "/tmp/foo" >>= (\x -> putStr x)
>(>>=) :: IO a -> (a -> IO b) -> IO b
This one is correct.
--
Ashley Yakeley, Seattle WA