I am new to Haskell, but I feel that I have a decent understanding of everyone.
I'm currently trying to play with unofficial mongoDB bindings for haskell.
If you look at the code here: http://github.com/srp/mongoDB/blob/master/Database/MongoDB.hs
connect :: HostName -> [ConnectOpt] -> IO Connection
connect = flip connectOnPort (Network.PortNumber 27017)
As you can see, this method returns / resolves the IO connection .
However, all methods that actually intercept the database take just Connection as an argument . Example:
disconnect :: Connection -> IO ()
disconnect = conClose
I think there is something fundamental, I don’t understand here, maybe IO has to do with the fact that it is part of IO Monad? I am really quite ignorant and I was wondering if anyone has any light to shed it on me.
How can I persuade an IO connection to a connection in mongoDB bindings?
Thanks for any input you have.
source
share