<div class="gmail_quote">On 17 December 2010 18:04, michael rice <span dir="ltr">&lt;<a href="mailto:nowgate@yahoo.com">nowgate@yahoo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font:inherit"><span style="font-family:courier,monaco,monospace,sans-serif">===================<br><br>f :: [Int] -&gt; IO [Int]</span><br style="font-family:courier,monaco,monospace,sans-serif">

<span style="font-family:courier,monaco,monospace,sans-serif">f lst = do return lst</span><br style="font-family:courier,monaco,monospace,sans-serif"><br style="font-family:courier,monaco,monospace,sans-serif"><span style="font-family:courier,monaco,monospace,sans-serif">main = do let lst = f [1,2,3,4,5]</span><br style="font-family:courier,monaco,monospace,sans-serif">

<span style="font-family:courier,monaco,monospace,sans-serif">          fmap (+1) lst</span></td></tr></tbody></table></blockquote><div> </div><div>The problem is that you are applying fmap to a type IO a.</div><div><br>
</div>
<div>fmap (+1) (return [1,2,3])</div><div><br></div><div>But to achieve the behaviour you expect, you need another fmap:</div><div><br></div><div>fmap (fmap (+1)) (return [1,2,3])</div></div>