app: Main: Add a running example of the DSL
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
parent
38d9cd6072
commit
08d89b1663
1 changed files with 16 additions and 1 deletions
17
app/Main.hs
17
app/Main.hs
|
@ -1,6 +1,21 @@
|
|||
{-# 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 = putStrLn "Free monad example"
|
||||
main = do
|
||||
putStrLn "Free monad example"
|
||||
conn <- connect defaultConnectInfo {
|
||||
connectDatabase = "postgres"
|
||||
}
|
||||
runDSL $ dslOperations conn
|
||||
|
|
Loading…
Reference in a new issue