I am not quite sure how to use the postgresqlConnect function in module Database.HaskellDB.HDBC.PostgreSQL to connect to a PostgreSQL database. The Haddock documentation page only states the type signature:
postgresqlConnect :: MonadIO m => [(String, String)] -> (Database -> m a) -> m a
What is a supposed to be?
How do I connect to a PostgreSQL server with postgresqlConnect?
This is what I guess: The first parameter is a list of options, if you have no specific options, just pass
[]. The next parameter is the code you actually want to run with the database. You get aDatabaseargument and can do any monadic stuff with it. ThepostgresqlConnectfunction evaluates this monadic action, disconnects the databse and returns the result of it –m a. Most time you probably want to useIO athough.