postgres-simple connection parameters

Filed under: programming

I was trying out the postgres-simple sample from here and couldn’t figure out the input prompt value to send into connectPostgreSQL until reading the pertinent section within the docs on haddock.

Turns out it’s very simple if one reads the right information!

To connect from CLI, use dbname='postgres' user='postgres' host='localhost'

To connect with hard coded values, use

-- In your file.hs
conn <- connect defaultConnectInfo {
          connectDatabase = "postgres",
          connectUser = "postgres"
        }