
16 Aug
2001
16 Aug
'01
7:30 p.m.
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
8678
Age (days ago)
8678
Last active (days ago)
0 comments
1 participants
participants (1)
-
Ashley Yakeley