{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ImpredicativeTypes #-} module Main (main) where import Thermoprint.Server import Thermoprint.Server.Printer.Generic import Control.Monad.Trans.Resource import Control.Monad.Logger import Control.Monad.Reader import Database.Persist.Sqlite main :: IO () main = thermoprintServer True (Nat runSqlite) $ (\c -> c { queueManagers = queueManagers }) <$> def `withPrinters` printers where runSqlite :: ReaderT ConnectionPool (LoggingT IO) a -> IO a runSqlite = runStderrLoggingT . withSqlitePool "thermoprint.sqlite" 1 . runReaderT printers = [ (pure $ genericPrint "/dev/usb/lp0", def) ] queueManagers _ = QMConfig { manager = union [ limitHistorySize 100 , limitHistoryAge 3600 ] , collapse = standardCollapse }