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