HaskellDB - "Database" variable is not included in scope

I am trying to run this haskelldb hello world example,

module Caturday.Model.Connect where

import Database.HaskellDB.HDBC
import Database.HaskellDB.Sql.PostgreSQL
import Database.HDBC.PostgreSQL (connectPostgreSQL)

withDB :: [(String,String)] -> (Database -> IO a) -> IO a
withDB opts = hdbcConnect generator (connectPostgreSQL conninfo)
  where conninfo = unwords [ k ++ "=" ++ v | (k,v) <- opts ]

opts = [("host","localhost")
       ,("user","your_username")
       ,("password","your_password")
       ,("dbname","your_db_name")]

      

This code is taken from the site

When running runhaskell db.hs, it throws an error like,

db.hs:7:33: Not in scope: type constructor or classDatabase

      

And the line,

withDB :: [(String,String)] -> (Database -> IO a) -> IO a

      

+3


source to share


1 answer


import Database.HaskellDB

Database

defined there, it should help



( https://github.com/m4dc4p/haskelldb/blob/master/src/Database/HaskellDB.hs#L68 )

+4


source







All Articles