Deep confusion about monads

Mark Carroll mark@chaos.x-philes.com
Thu, 16 Aug 2001 16:39:26 -0400 (EDT)


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?

-- Mark