free-monad-example/app/Main.hs

22 lines
468 B
Haskell
Raw Normal View History

{-# LANGUAGE OverloadedStrings #-}
module Main where
import Database.PostgreSQL.Simple
import Data.Text (pack)
import Lib
dslOperations :: Connection -> DSL ()
dslOperations conn = do
logMsg "Logging from inside the DSL"
xs <- runQuery conn "select 2 + 2"
logMsg $ pack $ show (xs :: [Only Int])
main :: IO ()
main = do
putStrLn "Free monad example"
conn <- connect defaultConnectInfo {
connectDatabase = "postgres"
}
runDSL $ dslOperations conn