google hosed my indentation<br><br>&gt; obtainCookies :: IO Curl -&gt; String -&gt; IO ()<br>&gt; obtainCookies curl responseBody = do<br>&gt;               curl&#39; &lt;- curl<br>&gt;               mapM_ (flip (curlResp curl&#39;) resourceOpts) $<br>
&gt;                     screenScraping responseBody<br><br><br><br><div class="gmail_quote">On Wed, Jan 26, 2011 at 3:32 PM, Michael Litchard <span dir="ltr">&lt;<a href="mailto:michael@schmong.org">michael@schmong.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Thank you.<br><br><pre>Here is where things stand now<div class="im"><br><br>&gt; obtainCookies :: IO Curl -&gt; String -&gt; IO ()<br>
&gt; obtainCookies curl responseBody = do<br>&gt; curl&#39; &lt;- curl<br></div><div class="im">&gt; mapM_ (flip (curlResp curl&#39;) resourceOpts) $<br>
&gt; screenScraping responseBody<br><br><br></div>and the error<br><br>htmlParsing.lhs:78:2:<div class="im"><br>Couldn&#39;t match expected type `[Char]&#39;<br></div>against inferred type `GHC.IO.Exception.IOException&#39;<br>
Expected type: String<br>
Inferred type: IOError<br>When using functional dependencies to combine<br>MonadError IOError IO,<br>arising from the dependency `m -&gt; e&#39;<br>in the instance declaration at &lt;no location info&gt;<br>MonadError String IO,<br>

arising from a use of `curlResp&#39; at HtmlParsing.lhs:80:29-42<br>When generalising the type(s) for `obtainCookies&#39;<br><br>I&#39;m way beyond my ken here, trying to grow. I have to do error handling (this will be production code when it grows up), got some suggestions on how to do so, but am flying blind in new territory.<br>

<br>Any suggestions on how to proceed would be much appreciate<code><span>d.</span></code></pre><div><div></div><div class="h5"><br><div class="gmail_quote">On Wed, Jan 26, 2011 at 3:13 PM, Daniel Fischer <span dir="ltr">&lt;<a href="mailto:daniel.is.fischer@googlemail.com" target="_blank">daniel.is.fischer@googlemail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div>On Wednesday 26 January 2011 23:51:18, Michael Litchard wrote:<br>
&gt; Here&#39;s what I&#39;m working with, followed by what I am trying to do, and<br>
&gt; the type error I get. I&#39;m leaving things out that I do not think are<br>
&gt; important. Let me know if I&#39;m missing nessecary info.<br>
&gt; &gt;<br>
&gt; &gt;<br>
</div><div>&gt; &gt; obtainCookies :: IO Curl -&gt; String -&gt; IO ()<br>
&gt; &gt; obtainCookies curl responseBody = do<br>
&gt; &gt;               curl&#39; &lt;- curl<br>
&gt; &gt;               let collectedResources = screenScraping responseBody<br>
&gt; &gt;                   in mapM ( curlResp curl&#39; resourceOpts)<br>
&gt;<br>
&gt; collectedResources<br>
&gt;<br>
<br>
</div>Looks like you need a flip here:<br>
<br>
           in mapM (flip (curlResp curl&#39;) resourceOpts) collectedResources<br>
<br>
&gt; &gt;               return ()<br>
<br>
If you&#39;re throwing away the results of the MapM&#39;ed actions, use mapM_<br>
<div><br>
obtainCookies curl responseBody = do<br>
    curl&#39; &lt;- curl<br>
</div>    mapM_ (flip (curlResp curl&#39;) resourceOpts) $<br>
          screenScraping responseBody<br>
<div><br>
&gt;<br>
&gt; this function does a monadic action (all I want is the cookies) and I<br>
&gt; don&#39;t need the return value. I am not sure that the final line return<br>
&gt; (), is what I want.<br>
&gt;<br>
&gt;<br>
&gt; My primary question is this. how do I map over collectedResources<br>
&gt; correctly? Secondary question, is the return correct?<br>
<br>
</div>Use mapM_<br>
<br>
</blockquote></div><br>
</div></div></blockquote></div><br>