title: Howto use mongoDB bindings for haskell
body: <p>I am pretty new to Haskell but I feel like I have a decent understanding over all. </p>
  
  <p>I'm currently trying to play with the unofficial mongoDB bindings for haskell. </p>
  
  <p>If you look at the code here: <a href="http://github.com/srp/mongoDB/blob/master/Database/MongoDB.hs" rel="nofollow noreferrer">http://github.com/srp/mongoDB/blob/master/Database/MongoDB.hs</a></p>
  
  <pre><code>connect :: HostName -&gt; [ConnectOpt] -&gt; IO Connection
  connect = flip connectOnPort (Network.PortNumber 27017)
  </code></pre>
  
  <p>As you can see this methods returns/resolves to an <strong>IO Connection</strong>. </p>
  
  <p>However all methods that actually interract with the database take a just plain <strong>Connection</strong> as an argument. Ex:</p>
  
  <pre><code>disconnect :: Connection -&gt; IO ()
  disconnect = conClose
  </code></pre>
  
  <p>I think there is something fundamental I'm not understanding here, maybe the IO has to do with it being part of the IO Monad? I'm really pretty clueless and was wondering if anyone has any light to shed on this for me. </p>
  
  <p>How can I coax a IO Connection to a Connection in the mongoDB bindings? </p>
  
  <p>Thanks for any input you may have. </p>