mateamt/src/Types/Reader.hs

39 lines
886 B
Haskell
Raw Normal View History

2023-07-07 22:16:05 +00:00
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleInstances #-}
2019-05-06 21:41:05 +00:00
module Types.Reader where
2019-12-19 01:40:54 +00:00
import qualified Data.Text as T
2019-05-06 21:41:05 +00:00
import Servant (Handler)
import Control.Concurrent.STM (TQueue)
2023-07-07 22:16:05 +00:00
import Control.Monad.IO.Class (liftIO)
2019-05-06 21:41:05 +00:00
import Control.Monad.Reader (ReaderT)
2023-07-07 22:16:05 +00:00
import Control.Monad.Time
import Crypto.JOSE.JWK
2019-05-06 21:41:05 +00:00
import Database.PostgreSQL.Simple (Connection)
import Network.Mail.Mime (Mail)
2019-05-06 21:41:05 +00:00
-- internal imports
import Types.Auth (TicketStore)
data ReadState = ReadState
2021-07-12 11:29:40 +00:00
{ rsConnection :: Connection
, rsTicketStore :: TicketStore
, rsCurrencySymbol :: T.Text
, rsCurrencyFraction :: Word
, rsSoftwareVersion :: T.Text
, rsSendmailPath :: FilePath
, rsMailQueue :: TQueue Mail
2023-07-07 22:16:05 +00:00
, rsJWTSecret :: JWK
2019-05-06 21:41:05 +00:00
}
type MateHandler = ReaderT ReadState Handler
2023-07-07 22:16:05 +00:00
instance MonadTime MateHandler where
currentTime = liftIO currentTime