From 8c507213094b53b634689eb24f388767eef38016 Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Thu, 28 Oct 2021 19:39:50 -0400 Subject: [PATCH] implemented GemHandler type --- gemserv.cabal | 2 ++ package.yaml | 1 + src/Network/GemServ/Types.hs | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/gemserv.cabal b/gemserv.cabal index 6a79dc5..93d6be7 100644 --- a/gemserv.cabal +++ b/gemserv.cabal @@ -35,6 +35,7 @@ library , tcp-streams >=1.0.1.1 && <1.1 , text >=1.2.4.1 && <1.3 , tls + , transformers , x509 default-language: Haskell2010 autogen-modules: Paths_gemserv @@ -56,6 +57,7 @@ test-suite gemserv-test , tcp-streams >=1.0.1.1 && <1.1 , text >=1.2.4.1 && <1.3 , tls + , transformers , x509 default-language: Haskell2010 autogen-modules: Paths_gemserv diff --git a/package.yaml b/package.yaml index 466c7a4..d0bb06f 100644 --- a/package.yaml +++ b/package.yaml @@ -27,6 +27,7 @@ dependencies: - bytestring >= 0.10.12.0 && < 0.11 - tcp-streams >= 1.0.1.1 && < 1.1 - text >= 1.2.4.1 && < 1.3 +- transformers - tls - x509 diff --git a/src/Network/GemServ/Types.hs b/src/Network/GemServ/Types.hs index b4179f4..5c61280 100644 --- a/src/Network/GemServ/Types.hs +++ b/src/Network/GemServ/Types.hs @@ -29,12 +29,14 @@ module Network.GemServ.Types ( GemURL (..), GemRequest (..), GemResponse (..), + GemHandler, -- * Constructors newGemURL, newGemRequest, newGemResponse, ) where +import Control.Monad.Trans.Reader (ReaderT) import qualified Data.ByteString as BS import Data.Word (Word8, Word32) import Data.X509 (Certificate) @@ -69,6 +71,9 @@ data GemResponse = GemResponse -- ^ The response body } deriving (Eq, Show) +-- | Handles a 'GemRequest' to produce a 'GemResponse' +type GemHandler m = ReaderT GemRequest m GemResponse + -- | Builds a new 'GemURL' newGemURL :: String