
16 Aug
2001
16 Aug
'01
9:36 p.m.
Hello again, On Thursday 16 August 2001 9:39 pm, Mark Carroll wrote:
That's embarrassing - I hit 'send' before I finished. Sorry. ):
On Thu, 16 Aug 2001, Mark Carroll wrote:
I should add that I do seem to have written something that sort of works:
firstChar :: [a] -> IO a firstChar xs = return head xs
I mean firstChar xs = return $ head xs
then,
readFile "/tmp/foo" >>= firstChar >>= putChar
(snip)
...what's surprising me is that do I really have to turn everything into an IO action like this just to do things with the String hidden in the IO String?
No, you could write instead.. (readFile "/tmp/foo") >>= (\foofile -> putChar (head foofile)) or.. (readFile "/tmp/foo") >>= (putChar . head) HTH Regards -- Adrian Hey