<div>Hi Stephen,<br></div><div><br></div><div>Thanks for the answer, I shall give it a go later tonight (UK time).</div><div><br></div><div>Why would I want to keep my functions monadic?  It&#39;s not that I&#39;m against the idea, rather it&#39;s that I don&#39;t understand the choice.  I was under the (possibly wrong) impression that (IO) monadic functions were just to &quot;get around&quot; the issue of side-effects and that where possible functions should be coded outside of monads.  Is that just plain wrong, or does it boil down to &quot;It depends on what you&#39;re doing, and in this case...&quot;?</div>
<div><br></div><div>Also I think I&#39;ve already encountered the hidden Data.Binary problem in GHC.  I have got around it already by (if memory serves) starting GHC and telling it to ignore it&#39;s own Data.Binary so I can then include it in my own projects.  But I created an alias which starts this Data.Binary-capable GHC and I can&#39;t remember what&#39;s behind it now!</div>
<div><br></div><div>What&#39;s the reason for GHC hiding packages and preventing them from being imported/used in loaded projects?</div><div><br></div><div>Thanks again for the help.</div><div><br></div><div>Tom</div><br>
<div class="gmail_quote">On Tue, Jun 15, 2010 at 9:15 PM, Stephen Tetley <span dir="ltr">&lt;<a href="mailto:stephen.tetley@gmail.com">stephen.tetley@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Tom<br>
<br>
Try ...<br>
<br>
extractInt :: [Word8] -&gt; Int<br>
<div class="im">extractInt = foldl addDigit 0<br>
               where<br>
</div>               addDigit num d = 10*num + (fromIntegral d)<br>
<br>
<br>
You might find you want to keep your functions monadic, and mostly use<br>
the Get monad from the module Data.Binary.Get for working with binary<br>
data.For instance there is a function getWord32be to do the work that<br>
extractInt is doing<br>
<br>
Best wishes<br>
<font color="#888888"><br>
Stephen<br>
</font></blockquote></div><br>