{-# LANGUAGE CPP                #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE OverloadedStrings  #-}
{-# LANGUAGE RankNTypes         #-}
{-# LANGUAGE RecordWildCards    #-}

module Airship.Internal.Decision
    ( flow
    , appendRequestPath
    ) where

import           Airship.Headers                  (addResponseHeader)
import           Airship.Internal.Date            (parseRfc1123Date,
                                                   utcTimeToRfc1123)
import           Airship.Internal.Parsers         (parseEtagList)
import           Airship.Resource                 (PostResponse (..),
                                                   Resource (..))
import           Airship.Types                    (Response (..),
                                                   ResponseBody (..),
                                                   Webmachine, addTrace,
                                                   etagToByteString,
                                                   getResponseBody,
                                                   getResponseHeaders, halt,
                                                   pathInfo, putResponseBody,
                                                   request, requestHeaders,
                                                   requestMethod, requestTime)
#if __GLASGOW_HASKELL__ < 710
import           Control.Applicative              ((<$>))
#endif
import           Control.Monad                    (when)
import           Control.Monad.Trans              (lift)
import           Control.Monad.Trans.State.Strict (StateT (..), evalStateT, get,
                                                   modify)


import           Blaze.ByteString.Builder         (toByteString)
import           Data.ByteString                  (ByteString, intercalate)
import           Data.Maybe                       (isJust)
import           Data.Text                        (Text)
import           Data.Time.Clock                  (UTCTime)

import           Network.HTTP.Media
import qualified Network.HTTP.Types               as HTTP

------------------------------------------------------------------------------
-- HTTP Headers
-- These are headers not defined for us already in
-- Network.HTTP.Types
------------------------------------------------------------------------------
-- TODO this exist in http-types-0.9, see CHANGES.txt
hAcceptCharset :: HTTP.HeaderName
hAcceptCharset :: HeaderName
hAcceptCharset = HeaderName
"Accept-Charset"

hAcceptEncoding :: HTTP.HeaderName
hAcceptEncoding :: HeaderName
hAcceptEncoding = HeaderName
"Accept-Encoding"

hIfMatch :: HTTP.HeaderName
hIfMatch :: HeaderName
hIfMatch = HeaderName
"If-Match"

hIfUnmodifiedSince :: HTTP.HeaderName
hIfUnmodifiedSince :: HeaderName
hIfUnmodifiedSince = HeaderName
"If-Unmodified-Since"

hIfNoneMatch :: HTTP.HeaderName
hIfNoneMatch :: HeaderName
hIfNoneMatch = HeaderName
"If-None-Match"

------------------------------------------------------------------------------
-- FlowState: StateT used for recording information as we walk the decision
-- tree
------------------------------------------------------------------------------

data FlowState m = FlowState
    { FlowState m -> Maybe (MediaType, Webmachine m ResponseBody)
_contentType :: Maybe (MediaType, Webmachine m ResponseBody) }

type FlowStateT m a = StateT (FlowState m) (Webmachine m) a

type Flow m = Resource m -> FlowStateT m Response

initFlowState :: FlowState m
initFlowState :: FlowState m
initFlowState = Maybe (MediaType, Webmachine m ResponseBody) -> FlowState m
forall (m :: * -> *).
Maybe (MediaType, Webmachine m ResponseBody) -> FlowState m
FlowState Maybe (MediaType, Webmachine m ResponseBody)
forall a. Maybe a
Nothing

flow :: Monad m => Resource m -> Webmachine m Response
flow :: Resource m -> Webmachine m Response
flow Resource m
r = StateT (FlowState m) (Webmachine m) Response
-> FlowState m -> Webmachine m Response
forall (m :: * -> *) s a. Monad m => StateT s m a -> s -> m a
evalStateT (Flow m
forall (m :: * -> *). Monad m => Flow m
b13 Resource m
r) FlowState m
forall (m :: * -> *). FlowState m
initFlowState

trace :: Monad m => ByteString -> FlowStateT m ()
trace :: ByteString -> FlowStateT m ()
trace ByteString
a = Webmachine m () -> FlowStateT m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m () -> FlowStateT m ())
-> Webmachine m () -> FlowStateT m ()
forall a b. (a -> b) -> a -> b
$ ByteString -> Webmachine m ()
forall (m :: * -> *). Monad m => ByteString -> Webmachine m ()
addTrace ByteString
a

-----------------------------------------------------------------------------
-- Header value data newtypes
------------------------------------------------------------------------------

newtype IfMatch = IfMatch ByteString
newtype IfNoneMatch = IfNoneMatch ByteString

------------------------------------------------------------------------------
-- Decision Helpers
------------------------------------------------------------------------------

negotiateContentTypesAccepted :: Monad m => [(MediaType, Webmachine m a)] -> FlowStateT m a
negotiateContentTypesAccepted :: [(MediaType, Webmachine m a)] -> FlowStateT m a
negotiateContentTypesAccepted [(MediaType, Webmachine m a)]
accepted = do
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    let reqHeaders :: RequestHeaders
reqHeaders = Request -> RequestHeaders
requestHeaders Request
req
        result :: Maybe (Webmachine m a)
result = do
            ByteString
cType <- HeaderName -> RequestHeaders -> Maybe ByteString
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup HeaderName
HTTP.hContentType RequestHeaders
reqHeaders
            [(MediaType, Webmachine m a)]
-> ByteString -> Maybe (Webmachine m a)
forall b. [(MediaType, b)] -> ByteString -> Maybe b
mapContentMedia [(MediaType, Webmachine m a)]
accepted ByteString
cType
    case Maybe (Webmachine m a)
result of
        (Just Webmachine m a
process) -> Webmachine m a -> FlowStateT m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m a
process
        Maybe (Webmachine m a)
Nothing -> Webmachine m a -> FlowStateT m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m a -> FlowStateT m a)
-> Webmachine m a -> FlowStateT m a
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m a
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status415

appendRequestPath :: Monad m => [Text] -> Webmachine m ByteString
appendRequestPath :: [Text] -> Webmachine m ByteString
appendRequestPath [Text]
ts = do
    [Text]
currentPath <- Request -> [Text]
pathInfo (Request -> [Text]) -> Webmachine m Request -> Webmachine m [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    ByteString -> Webmachine m ByteString
forall (m :: * -> *) a. Monad m => a -> m a
return (ByteString -> Webmachine m ByteString)
-> ByteString -> Webmachine m ByteString
forall a b. (a -> b) -> a -> b
$ Builder -> ByteString
toByteString ([Text] -> Builder
HTTP.encodePathSegments ([Text]
currentPath [Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [Text]
ts))

requestHeaderDate :: Monad m => HTTP.HeaderName ->
                                Webmachine m (Maybe UTCTime)
requestHeaderDate :: HeaderName -> Webmachine m (Maybe UTCTime)
requestHeaderDate HeaderName
headerName = do
    Request
req <- Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    let reqHeaders :: RequestHeaders
reqHeaders = Request -> RequestHeaders
requestHeaders Request
req
        dateHeader :: Maybe ByteString
dateHeader = HeaderName -> RequestHeaders -> Maybe ByteString
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup HeaderName
headerName RequestHeaders
reqHeaders
        parsedDate :: Maybe UTCTime
parsedDate = Maybe ByteString
dateHeader Maybe ByteString -> (ByteString -> Maybe UTCTime) -> Maybe UTCTime
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ByteString -> Maybe UTCTime
parseRfc1123Date
    Maybe UTCTime -> Webmachine m (Maybe UTCTime)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe UTCTime
parsedDate

writeCacheTags :: Monad m => Resource m -> FlowStateT m ()
writeCacheTags :: Resource m -> FlowStateT m ()
writeCacheTags Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
..} = Webmachine m () -> FlowStateT m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m () -> FlowStateT m ())
-> Webmachine m () -> FlowStateT m ()
forall a b. (a -> b) -> a -> b
$ do
    Maybe ETag
etag <- Webmachine m (Maybe ETag)
generateETag
    case Maybe ETag
etag of
       Maybe ETag
Nothing -> () -> Webmachine m ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
       Just ETag
t  -> Header -> Webmachine m ()
forall (m :: * -> *). Monad m => Header -> Webmachine m ()
addResponseHeader (HeaderName
"ETag", ETag -> ByteString
etagToByteString ETag
t)
    Maybe UTCTime
modified <- Webmachine m (Maybe UTCTime)
lastModified
    case Maybe UTCTime
modified of
       Maybe UTCTime
Nothing -> () -> Webmachine m ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
       Just UTCTime
d  -> Header -> Webmachine m ()
forall (m :: * -> *). Monad m => Header -> Webmachine m ()
addResponseHeader (HeaderName
"Last-Modified", UTCTime -> ByteString
utcTimeToRfc1123 UTCTime
d)

------------------------------------------------------------------------------
-- Type definitions for all decision nodes
------------------------------------------------------------------------------

b13, b12, b11, b10, b09, b08, b07, b06, b05, b04, b03 :: Monad m => Flow  m
c04, c03 :: Monad m => Flow  m
d05, d04 :: Monad m => Flow  m
e06, e05 :: Monad m => Flow  m
f07, f06 :: Monad m => Flow  m
g11, g09 :: Monad m => IfMatch -> Flow m
g08, g07 :: Monad m => Flow  m
h12, h11, h10, h07 :: Monad m => Flow  m
i13 :: Monad m => IfNoneMatch -> Flow m
i12, i07, i04 :: Monad m => Flow  m
j18 :: Monad m => Flow  m
k13 :: Monad m => IfNoneMatch -> Flow m
k07, k05 :: Monad m => Flow  m
l17, l15, l14, l13, l07, l05 :: Monad m => Flow  m
m20, m16, m07, m05 :: Monad m => Flow  m
n16, n11, n05 :: Monad m => Flow  m
o20, o18, o17, o16, o14 :: Monad m => Flow  m
p11, p03 :: Monad m => Flow  m

------------------------------------------------------------------------------
-- B column
------------------------------------------------------------------------------

b13 :: Flow m
b13 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"b13"
    Bool
available <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
serviceAvailable
    if Bool
available
        then Flow m
forall (m :: * -> *). Monad m => Flow m
b12 Resource m
r
        else Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status503

b12 :: Flow m
b12 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"b12"
    -- known method
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    let knownMethods :: [ByteString]
knownMethods = [ ByteString
HTTP.methodGet
                       , ByteString
HTTP.methodPost
                       , ByteString
HTTP.methodHead
                       , ByteString
HTTP.methodPut
                       , ByteString
HTTP.methodDelete
                       , ByteString
HTTP.methodTrace
                       , ByteString
HTTP.methodConnect
                       , ByteString
HTTP.methodOptions
                       , ByteString
HTTP.methodPatch
                       ]
    if Request -> ByteString
requestMethod Request
req ByteString -> [ByteString] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [ByteString]
knownMethods
        then Flow m
forall (m :: * -> *). Monad m => Flow m
b11 Resource m
r
        else Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status501

b11 :: Flow m
b11 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"b11"
    Bool
long <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
uriTooLong
    if Bool
long
        then Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status414
        else Flow m
forall (m :: * -> *). Monad m => Flow m
b10 Resource m
r

b10 :: Flow m
b10 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"b10"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    [ByteString]
allowed <- Webmachine m [ByteString]
-> StateT (FlowState m) (Webmachine m) [ByteString]
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m [ByteString]
allowedMethods
    if Request -> ByteString
requestMethod Request
req ByteString -> [ByteString] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [ByteString]
allowed
        then Flow m
forall (m :: * -> *). Monad m => Flow m
b09 Resource m
r
        else do
            Webmachine m () -> FlowStateT m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m () -> FlowStateT m ())
-> Webmachine m () -> FlowStateT m ()
forall a b. (a -> b) -> a -> b
$ Header -> Webmachine m ()
forall (m :: * -> *). Monad m => Header -> Webmachine m ()
addResponseHeader (HeaderName
"Allow",  ByteString -> [ByteString] -> ByteString
intercalate ByteString
"," [ByteString]
allowed)
            Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status405

b09 :: Flow m
b09 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"b09"
    Bool
malformed <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
malformedRequest
    if Bool
malformed
        then Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status400
        else Flow m
forall (m :: * -> *). Monad m => Flow m
b08 Resource m
r

b08 :: Flow m
b08 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"b08"
    Bool
authorized <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
isAuthorized
    if Bool
authorized
        then Flow m
forall (m :: * -> *). Monad m => Flow m
b07 Resource m
r
        else Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status401

b07 :: Flow m
b07 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"b07"
    Bool
forbid <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
forbidden
    if Bool
forbid
        then Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status403
        else Flow m
forall (m :: * -> *). Monad m => Flow m
b06 Resource m
r

b06 :: Flow m
b06 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"b06"
    Bool
validC <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
validContentHeaders
    if Bool
validC
        then Flow m
forall (m :: * -> *). Monad m => Flow m
b05 Resource m
r
        else Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status501

b05 :: Flow m
b05 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"b05"
    Bool
known <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
knownContentType
    if Bool
known
        then Flow m
forall (m :: * -> *). Monad m => Flow m
b04 Resource m
r
        else Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status415

b04 :: Flow m
b04 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"b04"
    Bool
large <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
entityTooLarge
    if Bool
large
        then Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status413
        else Flow m
forall (m :: * -> *). Monad m => Flow m
b03 Resource m
r

b03 :: Flow m
b03 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"b03"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    [ByteString]
allowed <- Webmachine m [ByteString]
-> StateT (FlowState m) (Webmachine m) [ByteString]
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m [ByteString]
allowedMethods
    if Request -> ByteString
requestMethod Request
req ByteString -> ByteString -> Bool
forall a. Eq a => a -> a -> Bool
== ByteString
HTTP.methodOptions
        then do
            Webmachine m () -> FlowStateT m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m () -> FlowStateT m ())
-> Webmachine m () -> FlowStateT m ()
forall a b. (a -> b) -> a -> b
$ Header -> Webmachine m ()
forall (m :: * -> *). Monad m => Header -> Webmachine m ()
addResponseHeader (HeaderName
"Allow",  ByteString -> [ByteString] -> ByteString
intercalate ByteString
"," [ByteString]
allowed)
            Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status204
        else Flow m
forall (m :: * -> *). Monad m => Flow m
c03 Resource m
r

------------------------------------------------------------------------------
-- C column
------------------------------------------------------------------------------

c04 :: Flow m
c04 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"c04"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    [(MediaType, Webmachine m ResponseBody)]
provided <- Webmachine m [(MediaType, Webmachine m ResponseBody)]
-> StateT
     (FlowState m)
     (Webmachine m)
     [(MediaType, Webmachine m ResponseBody)]
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesProvided
    let reqHeaders :: RequestHeaders
reqHeaders = Request -> RequestHeaders
requestHeaders Request
req
        result :: Maybe (MediaType, Webmachine m ResponseBody)
result = do
            ByteString
acceptStr <- HeaderName -> RequestHeaders -> Maybe ByteString
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup HeaderName
HTTP.hAccept RequestHeaders
reqHeaders
            (MediaType
acceptTyp, Webmachine m ResponseBody
resource) <- [(MediaType, (MediaType, Webmachine m ResponseBody))]
-> ByteString -> Maybe (MediaType, Webmachine m ResponseBody)
forall b. [(MediaType, b)] -> ByteString -> Maybe b
mapAcceptMedia [(MediaType, (MediaType, Webmachine m ResponseBody))]
provided' ByteString
acceptStr
            (MediaType, Webmachine m ResponseBody)
-> Maybe (MediaType, Webmachine m ResponseBody)
forall a. a -> Maybe a
Just (MediaType
acceptTyp, Webmachine m ResponseBody
resource)
            where
                -- this is so that in addition to getting back the resource
                -- that we match, we also return the content-type provided
                -- by that resource.
                provided' :: [(MediaType, (MediaType, Webmachine m ResponseBody))]
provided' = ((MediaType, Webmachine m ResponseBody)
 -> (MediaType, (MediaType, Webmachine m ResponseBody)))
-> [(MediaType, Webmachine m ResponseBody)]
-> [(MediaType, (MediaType, Webmachine m ResponseBody))]
forall a b. (a -> b) -> [a] -> [b]
map (MediaType, Webmachine m ResponseBody)
-> (MediaType, (MediaType, Webmachine m ResponseBody))
forall a b. (a, b) -> (a, (a, b))
dupContentType [(MediaType, Webmachine m ResponseBody)]
provided
                dupContentType :: (a, b) -> (a, (a, b))
dupContentType (a
a, b
b) = (a
a, (a
a, b
b))

    case Maybe (MediaType, Webmachine m ResponseBody)
result of
      Maybe (MediaType, Webmachine m ResponseBody)
Nothing -> Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status406
      Just (MediaType, Webmachine m ResponseBody)
res -> do
        (FlowState m -> FlowState m) -> FlowStateT m ()
forall (m :: * -> *) s. Monad m => (s -> s) -> StateT s m ()
modify (\FlowState m
fs -> FlowState m
fs { _contentType :: Maybe (MediaType, Webmachine m ResponseBody)
_contentType = (MediaType, Webmachine m ResponseBody)
-> Maybe (MediaType, Webmachine m ResponseBody)
forall a. a -> Maybe a
Just (MediaType, Webmachine m ResponseBody)
res })
        Flow m
forall (m :: * -> *). Monad m => Flow m
d04 Resource m
r

c03 :: Flow m
c03 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"c03"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    let reqHeaders :: RequestHeaders
reqHeaders = Request -> RequestHeaders
requestHeaders Request
req
    case HeaderName -> RequestHeaders -> Maybe ByteString
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup HeaderName
HTTP.hAccept RequestHeaders
reqHeaders of
        (Just ByteString
_h) ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
c04 Resource m
r
        Maybe ByteString
Nothing ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
d04 Resource m
r

------------------------------------------------------------------------------
-- D column
------------------------------------------------------------------------------

d05 :: Flow m
d05 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"d05"
    Bool
langAvailable <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
languageAvailable
    if Bool
langAvailable
        then Flow m
forall (m :: * -> *). Monad m => Flow m
e05 Resource m
r
        else Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status406

d04 :: Flow m
d04 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"d04"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    let reqHeaders :: RequestHeaders
reqHeaders = Request -> RequestHeaders
requestHeaders Request
req
    case HeaderName -> RequestHeaders -> Maybe ByteString
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup HeaderName
HTTP.hAcceptLanguage RequestHeaders
reqHeaders of
        (Just ByteString
_h) ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
d05 Resource m
r
        Maybe ByteString
Nothing ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
e05 Resource m
r

------------------------------------------------------------------------------
-- E column
------------------------------------------------------------------------------

e06 :: Flow m
e06 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"e06"
    -- TODO: charset negotiation
    Flow m
forall (m :: * -> *). Monad m => Flow m
f06 Resource m
r

e05 :: Flow m
e05 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"e05"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    let reqHeaders :: RequestHeaders
reqHeaders = Request -> RequestHeaders
requestHeaders Request
req
    case HeaderName -> RequestHeaders -> Maybe ByteString
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup HeaderName
hAcceptCharset RequestHeaders
reqHeaders of
        (Just ByteString
_h) ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
e06 Resource m
r
        Maybe ByteString
Nothing ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
f06 Resource m
r

------------------------------------------------------------------------------
-- F column
------------------------------------------------------------------------------

f07 :: Flow m
f07 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"f07"
    -- TODO: encoding negotiation
    Flow m
forall (m :: * -> *). Monad m => Flow m
g07 Resource m
r

f06 :: Flow m
f06 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"f06"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    let reqHeaders :: RequestHeaders
reqHeaders = Request -> RequestHeaders
requestHeaders Request
req
    case HeaderName -> RequestHeaders -> Maybe ByteString
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup HeaderName
hAcceptEncoding RequestHeaders
reqHeaders of
        (Just ByteString
_h) ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
f07 Resource m
r
        Maybe ByteString
Nothing ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
g07 Resource m
r

------------------------------------------------------------------------------
-- G column
------------------------------------------------------------------------------

g11 :: IfMatch -> Flow m
g11 (IfMatch ByteString
ifMatch) r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"g11"
    let etags :: [ETag]
etags = ByteString -> [ETag]
parseEtagList ByteString
ifMatch
    if [ETag] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [ETag]
etags
        then Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status412
        else Flow m
forall (m :: * -> *). Monad m => Flow m
h10 Resource m
r

g09 :: IfMatch -> Flow m
g09 IfMatch
ifMatch r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"g09"
    case IfMatch
ifMatch of
        -- TODO: should we be stripping whitespace here?
        (IfMatch ByteString
"*") ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
h10 Resource m
r
        IfMatch
_ ->
            IfMatch -> Flow m
forall (m :: * -> *). Monad m => IfMatch -> Flow m
g11 IfMatch
ifMatch Resource m
r

g08 :: Flow m
g08 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"g08"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    let reqHeaders :: RequestHeaders
reqHeaders = Request -> RequestHeaders
requestHeaders Request
req
    case ByteString -> IfMatch
IfMatch (ByteString -> IfMatch) -> Maybe ByteString -> Maybe IfMatch
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> HeaderName -> RequestHeaders -> Maybe ByteString
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup HeaderName
hIfMatch RequestHeaders
reqHeaders of
        (Just IfMatch
h) ->
            IfMatch -> Flow m
forall (m :: * -> *). Monad m => IfMatch -> Flow m
g09 IfMatch
h Resource m
r
        Maybe IfMatch
Nothing ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
h10 Resource m
r

g07 :: Flow m
g07 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"g07"
    -- TODO: set Vary headers
    Bool
exists <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
resourceExists
    if Bool
exists
        then Flow m
forall (m :: * -> *). Monad m => Flow m
g08 Resource m
r
        else Flow m
forall (m :: * -> *). Monad m => Flow m
h07 Resource m
r

------------------------------------------------------------------------------
-- H column
------------------------------------------------------------------------------

h12 :: Flow m
h12 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"h12"
    Maybe UTCTime
modified <- Webmachine m (Maybe UTCTime)
-> StateT (FlowState m) (Webmachine m) (Maybe UTCTime)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m (Maybe UTCTime)
lastModified
    Maybe UTCTime
parsedDate <- Webmachine m (Maybe UTCTime)
-> StateT (FlowState m) (Webmachine m) (Maybe UTCTime)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m (Maybe UTCTime)
 -> StateT (FlowState m) (Webmachine m) (Maybe UTCTime))
-> Webmachine m (Maybe UTCTime)
-> StateT (FlowState m) (Webmachine m) (Maybe UTCTime)
forall a b. (a -> b) -> a -> b
$ HeaderName -> Webmachine m (Maybe UTCTime)
forall (m :: * -> *).
Monad m =>
HeaderName -> Webmachine m (Maybe UTCTime)
requestHeaderDate HeaderName
hIfUnmodifiedSince
    let maybeGreater :: Maybe Bool
maybeGreater = do
            UTCTime
lastM <- Maybe UTCTime
modified
            UTCTime
headerDate <- Maybe UTCTime
parsedDate
            Bool -> Maybe Bool
forall (m :: * -> *) a. Monad m => a -> m a
return (UTCTime
lastM UTCTime -> UTCTime -> Bool
forall a. Ord a => a -> a -> Bool
> UTCTime
headerDate)
    if Maybe Bool
maybeGreater Maybe Bool -> Maybe Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True
        then Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status412
        else Flow m
forall (m :: * -> *). Monad m => Flow m
i12 Resource m
r

h11 :: Flow m
h11 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"h11"
    Maybe UTCTime
parsedDate <- Webmachine m (Maybe UTCTime)
-> StateT (FlowState m) (Webmachine m) (Maybe UTCTime)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m (Maybe UTCTime)
 -> StateT (FlowState m) (Webmachine m) (Maybe UTCTime))
-> Webmachine m (Maybe UTCTime)
-> StateT (FlowState m) (Webmachine m) (Maybe UTCTime)
forall a b. (a -> b) -> a -> b
$ HeaderName -> Webmachine m (Maybe UTCTime)
forall (m :: * -> *).
Monad m =>
HeaderName -> Webmachine m (Maybe UTCTime)
requestHeaderDate HeaderName
hIfUnmodifiedSince
    if Maybe UTCTime -> Bool
forall a. Maybe a -> Bool
isJust Maybe UTCTime
parsedDate
        then Flow m
forall (m :: * -> *). Monad m => Flow m
h12 Resource m
r
        else Flow m
forall (m :: * -> *). Monad m => Flow m
i12 Resource m
r

h10 :: Flow m
h10 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"h10"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    let reqHeaders :: RequestHeaders
reqHeaders = Request -> RequestHeaders
requestHeaders Request
req
    case HeaderName -> RequestHeaders -> Maybe ByteString
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup HeaderName
hIfUnmodifiedSince RequestHeaders
reqHeaders of
        (Just ByteString
_h) ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
h11 Resource m
r
        Maybe ByteString
Nothing ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
i12 Resource m
r

h07 :: Flow m
h07 r :: Resource m
r@Resource {Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"h07"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    let reqHeaders :: RequestHeaders
reqHeaders = Request -> RequestHeaders
requestHeaders Request
req
    case HeaderName -> RequestHeaders -> Maybe ByteString
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup HeaderName
hIfMatch RequestHeaders
reqHeaders of
        -- TODO: should we be stripping whitespace here?
        (Just ByteString
"*") ->
            Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status412
        Maybe ByteString
_ ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
i07 Resource m
r

------------------------------------------------------------------------------
-- I column
------------------------------------------------------------------------------

i13 :: IfNoneMatch -> Flow m
i13 IfNoneMatch
ifNoneMatch r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"i13"
    case IfNoneMatch
ifNoneMatch of
        -- TODO: should we be stripping whitespace here?
        (IfNoneMatch ByteString
"*") ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
j18 Resource m
r
        IfNoneMatch
_ ->
            IfNoneMatch -> Flow m
forall (m :: * -> *). Monad m => IfNoneMatch -> Flow m
k13 IfNoneMatch
ifNoneMatch Resource m
r

i12 :: Flow m
i12 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"i12"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    let reqHeaders :: RequestHeaders
reqHeaders = Request -> RequestHeaders
requestHeaders Request
req
    case ByteString -> IfNoneMatch
IfNoneMatch (ByteString -> IfNoneMatch)
-> Maybe ByteString -> Maybe IfNoneMatch
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> HeaderName -> RequestHeaders -> Maybe ByteString
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup HeaderName
hIfNoneMatch RequestHeaders
reqHeaders of
        (Just IfNoneMatch
h) ->
            IfNoneMatch -> Flow m
forall (m :: * -> *). Monad m => IfNoneMatch -> Flow m
i13 IfNoneMatch
h Resource m
r
        Maybe IfNoneMatch
Nothing ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
l13 Resource m
r

i07 :: Flow m
i07 Resource m
r = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"i07"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    if Request -> ByteString
requestMethod Request
req ByteString -> ByteString -> Bool
forall a. Eq a => a -> a -> Bool
== ByteString
HTTP.methodPut
        then Flow m
forall (m :: * -> *). Monad m => Flow m
i04 Resource m
r
        else Flow m
forall (m :: * -> *). Monad m => Flow m
k07 Resource m
r

i04 :: Flow m
i04 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"i04"
    Maybe ByteString
moved <- Webmachine m (Maybe ByteString)
-> StateT (FlowState m) (Webmachine m) (Maybe ByteString)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m (Maybe ByteString)
movedPermanently
    case Maybe ByteString
moved of
        (Just ByteString
loc) -> do
            Webmachine m () -> FlowStateT m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m () -> FlowStateT m ())
-> Webmachine m () -> FlowStateT m ()
forall a b. (a -> b) -> a -> b
$ Header -> Webmachine m ()
forall (m :: * -> *). Monad m => Header -> Webmachine m ()
addResponseHeader (HeaderName
"Location", ByteString
loc)
            Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status301
        Maybe ByteString
Nothing ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
p03 Resource m
r

------------------------------------------------------------------------------
-- J column
------------------------------------------------------------------------------

j18 :: Flow m
j18 Resource m
_ = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"j18"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    let getOrHead :: [ByteString]
getOrHead = [ ByteString
HTTP.methodGet
                    , ByteString
HTTP.methodHead
                    ]
    if Request -> ByteString
requestMethod Request
req ByteString -> [ByteString] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [ByteString]
getOrHead
        then Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status304
        else Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status412

------------------------------------------------------------------------------
-- K column
------------------------------------------------------------------------------

k13 :: IfNoneMatch -> Flow m
k13 (IfNoneMatch ByteString
ifNoneMatch) r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"k13"
    let etags :: [ETag]
etags = ByteString -> [ETag]
parseEtagList ByteString
ifNoneMatch
    if [ETag] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [ETag]
etags
        then Flow m
forall (m :: * -> *). Monad m => Flow m
l13 Resource m
r
        else Flow m
forall (m :: * -> *). Monad m => Flow m
j18 Resource m
r

k07 :: Flow m
k07 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"k07"
    Bool
prevExisted <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
previouslyExisted
    if Bool
prevExisted
        then Flow m
forall (m :: * -> *). Monad m => Flow m
k05 Resource m
r
        else Flow m
forall (m :: * -> *). Monad m => Flow m
l07 Resource m
r

k05 :: Flow m
k05 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"k05"
    Maybe ByteString
moved <- Webmachine m (Maybe ByteString)
-> StateT (FlowState m) (Webmachine m) (Maybe ByteString)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m (Maybe ByteString)
movedPermanently
    case Maybe ByteString
moved of
        (Just ByteString
loc) -> do
            Webmachine m () -> FlowStateT m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m () -> FlowStateT m ())
-> Webmachine m () -> FlowStateT m ()
forall a b. (a -> b) -> a -> b
$ Header -> Webmachine m ()
forall (m :: * -> *). Monad m => Header -> Webmachine m ()
addResponseHeader (HeaderName
"Location", ByteString
loc)
            Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status301
        Maybe ByteString
Nothing ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
l05 Resource m
r

------------------------------------------------------------------------------
-- L column
------------------------------------------------------------------------------

l17 :: Flow m
l17 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"l17"
    Maybe UTCTime
parsedDate <- Webmachine m (Maybe UTCTime)
-> StateT (FlowState m) (Webmachine m) (Maybe UTCTime)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m (Maybe UTCTime)
 -> StateT (FlowState m) (Webmachine m) (Maybe UTCTime))
-> Webmachine m (Maybe UTCTime)
-> StateT (FlowState m) (Webmachine m) (Maybe UTCTime)
forall a b. (a -> b) -> a -> b
$ HeaderName -> Webmachine m (Maybe UTCTime)
forall (m :: * -> *).
Monad m =>
HeaderName -> Webmachine m (Maybe UTCTime)
requestHeaderDate HeaderName
HTTP.hIfModifiedSince
    Maybe UTCTime
modified <- Webmachine m (Maybe UTCTime)
-> StateT (FlowState m) (Webmachine m) (Maybe UTCTime)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m (Maybe UTCTime)
lastModified
    let maybeGreater :: Maybe Bool
maybeGreater = do
            UTCTime
lastM <- Maybe UTCTime
modified
            UTCTime
ifModifiedSince <- Maybe UTCTime
parsedDate
            Bool -> Maybe Bool
forall (m :: * -> *) a. Monad m => a -> m a
return (UTCTime
lastM UTCTime -> UTCTime -> Bool
forall a. Ord a => a -> a -> Bool
> UTCTime
ifModifiedSince)
    if Maybe Bool
maybeGreater Maybe Bool -> Maybe Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True
        then Flow m
forall (m :: * -> *). Monad m => Flow m
m16 Resource m
r
        else Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status304

l15 :: Flow m
l15 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"l15"
    Maybe UTCTime
parsedDate <- Webmachine m (Maybe UTCTime)
-> StateT (FlowState m) (Webmachine m) (Maybe UTCTime)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m (Maybe UTCTime)
 -> StateT (FlowState m) (Webmachine m) (Maybe UTCTime))
-> Webmachine m (Maybe UTCTime)
-> StateT (FlowState m) (Webmachine m) (Maybe UTCTime)
forall a b. (a -> b) -> a -> b
$ HeaderName -> Webmachine m (Maybe UTCTime)
forall (m :: * -> *).
Monad m =>
HeaderName -> Webmachine m (Maybe UTCTime)
requestHeaderDate HeaderName
HTTP.hIfModifiedSince
    UTCTime
now <- Webmachine m UTCTime -> StateT (FlowState m) (Webmachine m) UTCTime
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m UTCTime
forall (m :: * -> *). Monad m => Webmachine m UTCTime
requestTime
    let maybeGreater :: Maybe Bool
maybeGreater = (UTCTime -> UTCTime -> Bool
forall a. Ord a => a -> a -> Bool
> UTCTime
now) (UTCTime -> Bool) -> Maybe UTCTime -> Maybe Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe UTCTime
parsedDate
    if Maybe Bool
maybeGreater Maybe Bool -> Maybe Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True
        then Flow m
forall (m :: * -> *). Monad m => Flow m
m16 Resource m
r
        else Flow m
forall (m :: * -> *). Monad m => Flow m
l17 Resource m
r

l14 :: Flow m
l14 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"l14"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    let reqHeaders :: RequestHeaders
reqHeaders = Request -> RequestHeaders
requestHeaders Request
req
        dateHeader :: Maybe ByteString
dateHeader = HeaderName -> RequestHeaders -> Maybe ByteString
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup HeaderName
HTTP.hIfModifiedSince RequestHeaders
reqHeaders
        validDate :: Bool
validDate = Maybe UTCTime -> Bool
forall a. Maybe a -> Bool
isJust (Maybe ByteString
dateHeader Maybe ByteString -> (ByteString -> Maybe UTCTime) -> Maybe UTCTime
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ByteString -> Maybe UTCTime
parseRfc1123Date)
    if Bool
validDate
        then Flow m
forall (m :: * -> *). Monad m => Flow m
l15 Resource m
r
        else Flow m
forall (m :: * -> *). Monad m => Flow m
m16 Resource m
r

l13 :: Flow m
l13 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"l13"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    let reqHeaders :: RequestHeaders
reqHeaders = Request -> RequestHeaders
requestHeaders Request
req
    case HeaderName -> RequestHeaders -> Maybe ByteString
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup HeaderName
HTTP.hIfModifiedSince RequestHeaders
reqHeaders of
        (Just ByteString
_h) ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
l14 Resource m
r
        Maybe ByteString
Nothing ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
m16 Resource m
r

l07 :: Flow m
l07 Resource m
r = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"l07"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    if Request -> ByteString
requestMethod Request
req ByteString -> ByteString -> Bool
forall a. Eq a => a -> a -> Bool
== ByteString
HTTP.methodPost
        then Flow m
forall (m :: * -> *). Monad m => Flow m
m07 Resource m
r
        else Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status404

l05 :: Flow m
l05 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"l05"
    Maybe ByteString
moved <- Webmachine m (Maybe ByteString)
-> StateT (FlowState m) (Webmachine m) (Maybe ByteString)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m (Maybe ByteString)
movedTemporarily
    case Maybe ByteString
moved of
        (Just ByteString
loc) -> do
            Webmachine m () -> FlowStateT m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m () -> FlowStateT m ())
-> Webmachine m () -> FlowStateT m ()
forall a b. (a -> b) -> a -> b
$ Header -> Webmachine m ()
forall (m :: * -> *). Monad m => Header -> Webmachine m ()
addResponseHeader (HeaderName
"Location", ByteString
loc)
            Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status307
        Maybe ByteString
Nothing ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
m05 Resource m
r

------------------------------------------------------------------------------
-- M column
------------------------------------------------------------------------------

m20 :: Flow m
m20 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"m20"
    Bool
deleteAccepted <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
deleteResource
    if Bool
deleteAccepted
        then do
            Bool
completed <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
deleteCompleted
            if Bool
completed
                then Flow m
forall (m :: * -> *). Monad m => Flow m
o20 Resource m
r
                else Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status202
        else Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status500

m16 :: Flow m
m16 Resource m
r = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"m16"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    if Request -> ByteString
requestMethod Request
req ByteString -> ByteString -> Bool
forall a. Eq a => a -> a -> Bool
== ByteString
HTTP.methodDelete
        then Flow m
forall (m :: * -> *). Monad m => Flow m
m20 Resource m
r
        else Flow m
forall (m :: * -> *). Monad m => Flow m
n16 Resource m
r

m07 :: Flow m
m07 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"m07"
    Bool
allowMissing <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
allowMissingPost
    if Bool
allowMissing
        then Flow m
forall (m :: * -> *). Monad m => Flow m
n11 Resource m
r
        else Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status404

m05 :: Flow m
m05 Resource m
r = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"m05"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    if Request -> ByteString
requestMethod Request
req ByteString -> ByteString -> Bool
forall a. Eq a => a -> a -> Bool
== ByteString
HTTP.methodPost
        then Flow m
forall (m :: * -> *). Monad m => Flow m
n05 Resource m
r
        else Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status410

------------------------------------------------------------------------------
-- N column
------------------------------------------------------------------------------

n16 :: Flow m
n16 Resource m
r = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"n16"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    if Request -> ByteString
requestMethod Request
req ByteString -> ByteString -> Bool
forall a. Eq a => a -> a -> Bool
== ByteString
HTTP.methodPost
        then Flow m
forall (m :: * -> *). Monad m => Flow m
n11 Resource m
r
        else Flow m
forall (m :: * -> *). Monad m => Flow m
o16 Resource m
r

n11 :: Flow m
n11 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"n11" FlowStateT m ()
-> StateT (FlowState m) (Webmachine m) (PostResponse m)
-> StateT (FlowState m) (Webmachine m) (PostResponse m)
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Webmachine m (PostResponse m)
-> StateT (FlowState m) (Webmachine m) (PostResponse m)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m (PostResponse m)
processPost StateT (FlowState m) (Webmachine m) (PostResponse m)
-> (PostResponse m -> StateT (FlowState m) (Webmachine m) Response)
-> StateT (FlowState m) (Webmachine m) Response
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (PostResponse m -> Flow m)
-> Resource m
-> PostResponse m
-> StateT (FlowState m) (Webmachine m) Response
forall a b c. (a -> b -> c) -> b -> a -> c
flip PostResponse m -> Flow m
forall (m :: * -> *). Monad m => PostResponse m -> Flow m
processPostAction Resource m
r

create :: Monad m => [Text] -> Resource m -> FlowStateT m ()
create :: [Text] -> Resource m -> FlowStateT m ()
create [Text]
ts Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString
loc <- Webmachine m ByteString
-> StateT (FlowState m) (Webmachine m) ByteString
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift ([Text] -> Webmachine m ByteString
forall (m :: * -> *). Monad m => [Text] -> Webmachine m ByteString
appendRequestPath [Text]
ts)
    Webmachine m () -> FlowStateT m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Header -> Webmachine m ()
forall (m :: * -> *). Monad m => Header -> Webmachine m ()
addResponseHeader (HeaderName
"Location", ByteString
loc))
    Webmachine m [(MediaType, Webmachine m ())]
-> StateT
     (FlowState m) (Webmachine m) [(MediaType, Webmachine m ())]
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m [(MediaType, Webmachine m ())]
contentTypesAccepted StateT (FlowState m) (Webmachine m) [(MediaType, Webmachine m ())]
-> ([(MediaType, Webmachine m ())] -> FlowStateT m ())
-> FlowStateT m ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= [(MediaType, Webmachine m ())] -> FlowStateT m ()
forall (m :: * -> *) a.
Monad m =>
[(MediaType, Webmachine m a)] -> FlowStateT m a
negotiateContentTypesAccepted

processPostAction :: Monad m => PostResponse m -> Flow  m
processPostAction :: PostResponse m -> Flow m
processPostAction (PostCreate [Text]
ts) Resource m
r = do
    [Text] -> Resource m -> FlowStateT m ()
forall (m :: * -> *).
Monad m =>
[Text] -> Resource m -> FlowStateT m ()
create [Text]
ts Resource m
r
    Flow m
forall (m :: * -> *). Monad m => Flow m
p11 Resource m
r
processPostAction (PostCreateRedirect [Text]
ts) Resource m
r = do
    [Text] -> Resource m -> FlowStateT m ()
forall (m :: * -> *).
Monad m =>
[Text] -> Resource m -> FlowStateT m ()
create [Text]
ts Resource m
r
    Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status303
processPostAction (PostProcess [(MediaType, Webmachine m ())]
accepted) Resource m
r = do
    [(MediaType, Webmachine m ())] -> FlowStateT m ()
forall (m :: * -> *) a.
Monad m =>
[(MediaType, Webmachine m a)] -> FlowStateT m a
negotiateContentTypesAccepted [(MediaType, Webmachine m ())]
accepted FlowStateT m () -> FlowStateT m Response -> FlowStateT m Response
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Flow m
forall (m :: * -> *). Monad m => Flow m
p11 Resource m
r
processPostAction (PostProcessRedirect [(MediaType, Webmachine m ByteString)]
accepted) Resource m
_r = do
    ByteString
locBs <- [(MediaType, Webmachine m ByteString)] -> FlowStateT m ByteString
forall (m :: * -> *) a.
Monad m =>
[(MediaType, Webmachine m a)] -> FlowStateT m a
negotiateContentTypesAccepted [(MediaType, Webmachine m ByteString)]
accepted
    Webmachine m () -> FlowStateT m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m () -> FlowStateT m ())
-> Webmachine m () -> FlowStateT m ()
forall a b. (a -> b) -> a -> b
$ Header -> Webmachine m ()
forall (m :: * -> *). Monad m => Header -> Webmachine m ()
addResponseHeader (HeaderName
"Location", ByteString
locBs)
    Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status303

n05 :: Flow m
n05 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"n05"
    Bool
allow <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
allowMissingPost
    if Bool
allow
        then Flow m
forall (m :: * -> *). Monad m => Flow m
n11 Resource m
r
        else Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status410

------------------------------------------------------------------------------
-- O column
------------------------------------------------------------------------------

o20 :: Flow m
o20 Resource m
r = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"o20"
    ResponseBody
body <- Webmachine m ResponseBody
-> StateT (FlowState m) (Webmachine m) ResponseBody
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m ResponseBody
forall (m :: * -> *). Monad m => Webmachine m ResponseBody
getResponseBody
    -- ResponseBody is a little tough to make an instance of 'Eq',
    -- so we just use a pattern match
    case ResponseBody
body of
        ResponseBody
Empty   -> Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status204
        ResponseBody
_       -> Flow m
forall (m :: * -> *). Monad m => Flow m
o18 Resource m
r

o18 :: Flow m
o18 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"o18"
    Bool
multiple <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
multipleChoices
    if Bool
multiple
        then Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status300
        else do
            -- TODO: set etag, expiration, etc. headers
            Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
            let getOrHead :: [ByteString]
getOrHead = [ ByteString
HTTP.methodGet
                            , ByteString
HTTP.methodHead
                            ]
            Bool -> FlowStateT m () -> FlowStateT m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Request -> ByteString
requestMethod Request
req ByteString -> [ByteString] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [ByteString]
getOrHead) (FlowStateT m () -> FlowStateT m ())
-> FlowStateT m () -> FlowStateT m ()
forall a b. (a -> b) -> a -> b
$ do
                Maybe (MediaType, Webmachine m ResponseBody)
m <- FlowState m -> Maybe (MediaType, Webmachine m ResponseBody)
forall (m :: * -> *).
FlowState m -> Maybe (MediaType, Webmachine m ResponseBody)
_contentType (FlowState m -> Maybe (MediaType, Webmachine m ResponseBody))
-> StateT (FlowState m) (Webmachine m) (FlowState m)
-> StateT
     (FlowState m)
     (Webmachine m)
     (Maybe (MediaType, Webmachine m ResponseBody))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> StateT (FlowState m) (Webmachine m) (FlowState m)
forall (m :: * -> *) s. Monad m => StateT s m s
get
                (MediaType
cType, Webmachine m ResponseBody
body) <- case Maybe (MediaType, Webmachine m ResponseBody)
m of
                    Maybe (MediaType, Webmachine m ResponseBody)
Nothing -> do
                        [(MediaType, Webmachine m ResponseBody)]
provided <- Webmachine m [(MediaType, Webmachine m ResponseBody)]
-> StateT
     (FlowState m)
     (Webmachine m)
     [(MediaType, Webmachine m ResponseBody)]
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesProvided
                        (MediaType, Webmachine m ResponseBody)
-> StateT
     (FlowState m) (Webmachine m) (MediaType, Webmachine m ResponseBody)
forall (m :: * -> *) a. Monad m => a -> m a
return ([(MediaType, Webmachine m ResponseBody)]
-> (MediaType, Webmachine m ResponseBody)
forall a. [a] -> a
head [(MediaType, Webmachine m ResponseBody)]
provided)
                    Just (MediaType
cType, Webmachine m ResponseBody
body) ->
                        (MediaType, Webmachine m ResponseBody)
-> StateT
     (FlowState m) (Webmachine m) (MediaType, Webmachine m ResponseBody)
forall (m :: * -> *) a. Monad m => a -> m a
return (MediaType
cType, Webmachine m ResponseBody
body)
                ResponseBody
b <- Webmachine m ResponseBody
-> StateT (FlowState m) (Webmachine m) ResponseBody
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m ResponseBody
body
                Webmachine m () -> FlowStateT m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m () -> FlowStateT m ())
-> Webmachine m () -> FlowStateT m ()
forall a b. (a -> b) -> a -> b
$ ResponseBody -> Webmachine m ()
forall (m :: * -> *). Monad m => ResponseBody -> Webmachine m ()
putResponseBody ResponseBody
b
                Webmachine m () -> FlowStateT m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m () -> FlowStateT m ())
-> Webmachine m () -> FlowStateT m ()
forall a b. (a -> b) -> a -> b
$ Header -> Webmachine m ()
forall (m :: * -> *). Monad m => Header -> Webmachine m ()
addResponseHeader (HeaderName
"Content-Type", MediaType -> ByteString
forall h. RenderHeader h => h -> ByteString
renderHeader MediaType
cType)
            Resource m -> FlowStateT m ()
forall (m :: * -> *). Monad m => Resource m -> FlowStateT m ()
writeCacheTags Resource m
r
            Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status200

o16 :: Flow m
o16 Resource m
r = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"o16"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    if Request -> ByteString
requestMethod Request
req ByteString -> ByteString -> Bool
forall a. Eq a => a -> a -> Bool
== ByteString
HTTP.methodPut
        then Flow m
forall (m :: * -> *). Monad m => Flow m
o14 Resource m
r
        else Flow m
forall (m :: * -> *). Monad m => Flow m
o17 Resource m
r

o17 :: Flow m
o17 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"o17"
    Request
req <- Webmachine m Request -> StateT (FlowState m) (Webmachine m) Request
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Request
forall (m :: * -> *). Monad m => Webmachine m Request
request
    if Request -> ByteString
requestMethod Request
req ByteString -> ByteString -> Bool
forall a. Eq a => a -> a -> Bool
/= ByteString
HTTP.methodPatch
       then Flow m
forall (m :: * -> *). Monad m => Flow m
o18 Resource m
r
       else Webmachine m [(MediaType, Webmachine m ())]
-> StateT
     (FlowState m) (Webmachine m) [(MediaType, Webmachine m ())]
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m [(MediaType, Webmachine m ())]
patchContentTypesAccepted StateT (FlowState m) (Webmachine m) [(MediaType, Webmachine m ())]
-> ([(MediaType, Webmachine m ())] -> FlowStateT m ())
-> FlowStateT m ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= [(MediaType, Webmachine m ())] -> FlowStateT m ()
forall (m :: * -> *) a.
Monad m =>
[(MediaType, Webmachine m a)] -> FlowStateT m a
negotiateContentTypesAccepted FlowStateT m () -> FlowStateT m Response -> FlowStateT m Response
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Flow m
forall (m :: * -> *). Monad m => Flow m
o20 Resource m
r


o14 :: Flow m
o14 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"o14"
    Bool
conflict <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
isConflict
    if Bool
conflict
        then Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status409
        else Webmachine m [(MediaType, Webmachine m ())]
-> StateT
     (FlowState m) (Webmachine m) [(MediaType, Webmachine m ())]
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m [(MediaType, Webmachine m ())]
contentTypesAccepted StateT (FlowState m) (Webmachine m) [(MediaType, Webmachine m ())]
-> ([(MediaType, Webmachine m ())] -> FlowStateT m ())
-> FlowStateT m ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= [(MediaType, Webmachine m ())] -> FlowStateT m ()
forall (m :: * -> *) a.
Monad m =>
[(MediaType, Webmachine m a)] -> FlowStateT m a
negotiateContentTypesAccepted FlowStateT m () -> FlowStateT m Response -> FlowStateT m Response
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Flow m
forall (m :: * -> *). Monad m => Flow m
p11 Resource m
r

------------------------------------------------------------------------------
-- P column
------------------------------------------------------------------------------

p11 :: Flow m
p11 Resource m
r = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"p11"
    RequestHeaders
headers <- Webmachine m RequestHeaders
-> StateT (FlowState m) (Webmachine m) RequestHeaders
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m RequestHeaders
forall (m :: * -> *). Monad m => Webmachine m RequestHeaders
getResponseHeaders
    case HeaderName -> RequestHeaders -> Maybe ByteString
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup HeaderName
HTTP.hLocation RequestHeaders
headers of
        (Just ByteString
_) ->
            Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status201
        Maybe ByteString
_ ->
            Flow m
forall (m :: * -> *). Monad m => Flow m
o20 Resource m
r

p03 :: Flow m
p03 r :: Resource m
r@Resource{Webmachine m Bool
Webmachine m [(MediaType, Webmachine m ())]
Webmachine m [(MediaType, Webmachine m ResponseBody)]
Webmachine m [ByteString]
Webmachine m (Maybe ByteString)
Webmachine m (Maybe UTCTime)
Webmachine m (Maybe ETag)
Webmachine m (PostResponse m)
ErrorResponses m
errorResponses :: ErrorResponses m
validContentHeaders :: Webmachine m Bool
uriTooLong :: Webmachine m Bool
serviceAvailable :: Webmachine m Bool
resourceExists :: Webmachine m Bool
processPost :: Webmachine m (PostResponse m)
previouslyExisted :: Webmachine m Bool
patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: Webmachine m Bool
movedTemporarily :: Webmachine m (Maybe ByteString)
movedPermanently :: Webmachine m (Maybe ByteString)
malformedRequest :: Webmachine m Bool
languageAvailable :: Webmachine m Bool
lastModified :: Webmachine m (Maybe UTCTime)
knownContentType :: Webmachine m Bool
isConflict :: Webmachine m Bool
isAuthorized :: Webmachine m Bool
implemented :: Webmachine m Bool
generateETag :: Webmachine m (Maybe ETag)
forbidden :: Webmachine m Bool
entityTooLarge :: Webmachine m Bool
deleteResource :: Webmachine m Bool
deleteCompleted :: Webmachine m Bool
contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: Webmachine m [ByteString]
allowMissingPost :: Webmachine m Bool
errorResponses :: forall (m :: * -> *).
Resource m
-> Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
validContentHeaders :: forall (m :: * -> *). Resource m -> Webmachine m Bool
uriTooLong :: forall (m :: * -> *). Resource m -> Webmachine m Bool
serviceAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
resourceExists :: forall (m :: * -> *). Resource m -> Webmachine m Bool
processPost :: forall (m :: * -> *). Resource m -> Webmachine m (PostResponse m)
previouslyExisted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
patchContentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
multipleChoices :: forall (m :: * -> *). Resource m -> Webmachine m Bool
movedTemporarily :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
movedPermanently :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ByteString)
malformedRequest :: forall (m :: * -> *). Resource m -> Webmachine m Bool
languageAvailable :: forall (m :: * -> *). Resource m -> Webmachine m Bool
lastModified :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe UTCTime)
knownContentType :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isConflict :: forall (m :: * -> *). Resource m -> Webmachine m Bool
isAuthorized :: forall (m :: * -> *). Resource m -> Webmachine m Bool
implemented :: forall (m :: * -> *). Resource m -> Webmachine m Bool
generateETag :: forall (m :: * -> *). Resource m -> Webmachine m (Maybe ETag)
forbidden :: forall (m :: * -> *). Resource m -> Webmachine m Bool
entityTooLarge :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteResource :: forall (m :: * -> *). Resource m -> Webmachine m Bool
deleteCompleted :: forall (m :: * -> *). Resource m -> Webmachine m Bool
contentTypesProvided :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ResponseBody)]
contentTypesAccepted :: forall (m :: * -> *).
Resource m -> Webmachine m [(MediaType, Webmachine m ())]
allowedMethods :: forall (m :: * -> *). Resource m -> Webmachine m [ByteString]
allowMissingPost :: forall (m :: * -> *). Resource m -> Webmachine m Bool
..} = do
    ByteString -> FlowStateT m ()
forall (m :: * -> *). Monad m => ByteString -> FlowStateT m ()
trace ByteString
"p03"
    Bool
conflict <- Webmachine m Bool -> StateT (FlowState m) (Webmachine m) Bool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m Bool
isConflict
    if Bool
conflict
        then Webmachine m Response -> FlowStateT m Response
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Webmachine m Response -> FlowStateT m Response)
-> Webmachine m Response -> FlowStateT m Response
forall a b. (a -> b) -> a -> b
$ Status -> Webmachine m Response
forall (m :: * -> *) a. Monad m => Status -> Webmachine m a
halt Status
HTTP.status409
        else Webmachine m [(MediaType, Webmachine m ())]
-> StateT
     (FlowState m) (Webmachine m) [(MediaType, Webmachine m ())]
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Webmachine m [(MediaType, Webmachine m ())]
contentTypesAccepted StateT (FlowState m) (Webmachine m) [(MediaType, Webmachine m ())]
-> ([(MediaType, Webmachine m ())] -> FlowStateT m ())
-> FlowStateT m ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= [(MediaType, Webmachine m ())] -> FlowStateT m ()
forall (m :: * -> *) a.
Monad m =>
[(MediaType, Webmachine m a)] -> FlowStateT m a
negotiateContentTypesAccepted FlowStateT m () -> FlowStateT m Response -> FlowStateT m Response
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Flow m
forall (m :: * -> *). Monad m => Flow m
p11 Resource m
r