module WebGear.Core.Trait.Status (
Status (..),
mkResponse,
continue100,
switchingProtocols101,
ok200,
created201,
accepted202,
nonAuthoritative203,
noContent204,
resetContent205,
partialContent206,
multipleChoices300,
movedPermanently301,
found302,
seeOther303,
notModified304,
temporaryRedirect307,
permanentRedirect308,
badRequest400,
unauthorized401,
paymentRequired402,
forbidden403,
notFound404,
methodNotAllowed405,
notAcceptable406,
proxyAuthenticationRequired407,
requestTimeout408,
conflict409,
gone410,
lengthRequired411,
preconditionFailed412,
requestEntityTooLarge413,
requestURITooLong414,
unsupportedMediaType415,
requestedRangeNotSatisfiable416,
expectationFailed417,
imATeapot418,
unprocessableEntity422,
preconditionRequired428,
tooManyRequests429,
requestHeaderFieldsTooLarge431,
internalServerError500,
notImplemented501,
badGateway502,
serviceUnavailable503,
gatewayTimeout504,
httpVersionNotSupported505,
networkAuthenticationRequired511,
) where
import qualified Network.HTTP.Types as HTTP
import WebGear.Core.Response (Response (..), ResponseBody (ResponseBodyBuilder))
import WebGear.Core.Trait (Attribute, Set, With, plant, wzero)
newtype Status = Status HTTP.Status
type instance Attribute Status Response = HTTP.Status
mkResponse :: (Set h Status) => HTTP.Status -> h () (Response `With` '[Status])
mkResponse :: forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
status = proc () -> do
let response :: With Response '[]
response = Response -> With Response '[]
forall a. a -> With a '[]
wzero (Response -> With Response '[]) -> Response -> With Response '[]
forall a b. (a -> b) -> a -> b
$ Status -> ResponseHeaders -> ResponseBody -> Response
Response Status
status [] (Builder -> ResponseBody
ResponseBodyBuilder Builder
forall a. Monoid a => a
mempty)
Status
-> h (With Response '[], Attribute Status Response)
(With Response '[Status])
forall t (ts :: [*]) (h :: * -> * -> *).
Set h t =>
t
-> h (With Response ts, Attribute t Response)
(With Response (t : ts))
plant (Status -> Status
Status Status
status) -< (With Response '[]
response, Status
status)
{-# INLINE mkResponse #-}
continue100 :: (Set h Status) => h () (Response `With` '[Status])
continue100 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
continue100 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.continue100
{-# INLINE continue100 #-}
switchingProtocols101 :: (Set h Status) => h () (Response `With` '[Status])
switchingProtocols101 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
switchingProtocols101 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.switchingProtocols101
{-# INLINE switchingProtocols101 #-}
ok200 :: (Set h Status) => h () (Response `With` '[Status])
ok200 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
ok200 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.ok200
{-# INLINE ok200 #-}
created201 :: (Set h Status) => h () (Response `With` '[Status])
created201 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
created201 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.created201
{-# INLINE created201 #-}
accepted202 :: (Set h Status) => h () (Response `With` '[Status])
accepted202 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
accepted202 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.accepted202
{-# INLINE accepted202 #-}
nonAuthoritative203 :: (Set h Status) => h () (Response `With` '[Status])
nonAuthoritative203 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
nonAuthoritative203 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.nonAuthoritative203
{-# INLINE nonAuthoritative203 #-}
noContent204 :: (Set h Status) => h () (Response `With` '[Status])
noContent204 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
noContent204 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.noContent204
{-# INLINE noContent204 #-}
resetContent205 :: (Set h Status) => h () (Response `With` '[Status])
resetContent205 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
resetContent205 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.resetContent205
{-# INLINE resetContent205 #-}
partialContent206 :: (Set h Status) => h () (Response `With` '[Status])
partialContent206 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
partialContent206 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.partialContent206
{-# INLINE partialContent206 #-}
multipleChoices300 :: (Set h Status) => h () (Response `With` '[Status])
multipleChoices300 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
multipleChoices300 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.multipleChoices300
{-# INLINE multipleChoices300 #-}
movedPermanently301 :: (Set h Status) => h () (Response `With` '[Status])
movedPermanently301 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
movedPermanently301 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.movedPermanently301
{-# INLINE movedPermanently301 #-}
found302 :: (Set h Status) => h () (Response `With` '[Status])
found302 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
found302 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.found302
{-# INLINE found302 #-}
seeOther303 :: (Set h Status) => h () (Response `With` '[Status])
seeOther303 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
seeOther303 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.seeOther303
{-# INLINE seeOther303 #-}
notModified304 :: (Set h Status) => h () (Response `With` '[Status])
notModified304 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
notModified304 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.notModified304
{-# INLINE notModified304 #-}
temporaryRedirect307 :: (Set h Status) => h () (Response `With` '[Status])
temporaryRedirect307 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
temporaryRedirect307 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.temporaryRedirect307
{-# INLINE temporaryRedirect307 #-}
permanentRedirect308 :: (Set h Status) => h () (Response `With` '[Status])
permanentRedirect308 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
permanentRedirect308 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.permanentRedirect308
{-# INLINE permanentRedirect308 #-}
badRequest400 :: (Set h Status) => h () (Response `With` '[Status])
badRequest400 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
badRequest400 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.badRequest400
{-# INLINE badRequest400 #-}
unauthorized401 :: (Set h Status) => h () (Response `With` '[Status])
unauthorized401 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
unauthorized401 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.unauthorized401
{-# INLINE unauthorized401 #-}
paymentRequired402 :: (Set h Status) => h () (Response `With` '[Status])
paymentRequired402 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
paymentRequired402 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.paymentRequired402
{-# INLINE paymentRequired402 #-}
forbidden403 :: (Set h Status) => h () (Response `With` '[Status])
forbidden403 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
forbidden403 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.forbidden403
{-# INLINE forbidden403 #-}
notFound404 :: (Set h Status) => h () (Response `With` '[Status])
notFound404 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
notFound404 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.notFound404
{-# INLINE notFound404 #-}
methodNotAllowed405 :: (Set h Status) => h () (Response `With` '[Status])
methodNotAllowed405 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
methodNotAllowed405 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.methodNotAllowed405
{-# INLINE methodNotAllowed405 #-}
notAcceptable406 :: (Set h Status) => h () (Response `With` '[Status])
notAcceptable406 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
notAcceptable406 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.notAcceptable406
{-# INLINE notAcceptable406 #-}
proxyAuthenticationRequired407 :: (Set h Status) => h () (Response `With` '[Status])
proxyAuthenticationRequired407 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
proxyAuthenticationRequired407 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.proxyAuthenticationRequired407
{-# INLINE proxyAuthenticationRequired407 #-}
requestTimeout408 :: (Set h Status) => h () (Response `With` '[Status])
requestTimeout408 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
requestTimeout408 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.requestTimeout408
{-# INLINE requestTimeout408 #-}
conflict409 :: (Set h Status) => h () (Response `With` '[Status])
conflict409 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
conflict409 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.conflict409
{-# INLINE conflict409 #-}
gone410 :: (Set h Status) => h () (Response `With` '[Status])
gone410 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
gone410 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.gone410
{-# INLINE gone410 #-}
lengthRequired411 :: (Set h Status) => h () (Response `With` '[Status])
lengthRequired411 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
lengthRequired411 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.lengthRequired411
{-# INLINE lengthRequired411 #-}
preconditionFailed412 :: (Set h Status) => h () (Response `With` '[Status])
preconditionFailed412 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
preconditionFailed412 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.preconditionFailed412
{-# INLINE preconditionFailed412 #-}
requestEntityTooLarge413 :: (Set h Status) => h () (Response `With` '[Status])
requestEntityTooLarge413 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
requestEntityTooLarge413 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.requestEntityTooLarge413
{-# INLINE requestEntityTooLarge413 #-}
requestURITooLong414 :: (Set h Status) => h () (Response `With` '[Status])
requestURITooLong414 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
requestURITooLong414 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.requestURITooLong414
{-# INLINE requestURITooLong414 #-}
unsupportedMediaType415 :: (Set h Status) => h () (Response `With` '[Status])
unsupportedMediaType415 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
unsupportedMediaType415 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.unsupportedMediaType415
{-# INLINE unsupportedMediaType415 #-}
requestedRangeNotSatisfiable416 :: (Set h Status) => h () (Response `With` '[Status])
requestedRangeNotSatisfiable416 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
requestedRangeNotSatisfiable416 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.requestedRangeNotSatisfiable416
{-# INLINE requestedRangeNotSatisfiable416 #-}
expectationFailed417 :: (Set h Status) => h () (Response `With` '[Status])
expectationFailed417 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
expectationFailed417 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.expectationFailed417
{-# INLINE expectationFailed417 #-}
imATeapot418 :: (Set h Status) => h () (Response `With` '[Status])
imATeapot418 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
imATeapot418 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.imATeapot418
{-# INLINE imATeapot418 #-}
unprocessableEntity422 :: (Set h Status) => h () (Response `With` '[Status])
unprocessableEntity422 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
unprocessableEntity422 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.unprocessableEntity422
{-# INLINE unprocessableEntity422 #-}
preconditionRequired428 :: (Set h Status) => h () (Response `With` '[Status])
preconditionRequired428 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
preconditionRequired428 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.preconditionRequired428
{-# INLINE preconditionRequired428 #-}
tooManyRequests429 :: (Set h Status) => h () (Response `With` '[Status])
tooManyRequests429 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
tooManyRequests429 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.tooManyRequests429
{-# INLINE tooManyRequests429 #-}
requestHeaderFieldsTooLarge431 :: (Set h Status) => h () (Response `With` '[Status])
= Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.requestHeaderFieldsTooLarge431
{-# INLINE requestHeaderFieldsTooLarge431 #-}
internalServerError500 :: (Set h Status) => h () (Response `With` '[Status])
internalServerError500 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
internalServerError500 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.internalServerError500
{-# INLINE internalServerError500 #-}
notImplemented501 :: (Set h Status) => h () (Response `With` '[Status])
notImplemented501 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
notImplemented501 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.notImplemented501
{-# INLINE notImplemented501 #-}
badGateway502 :: (Set h Status) => h () (Response `With` '[Status])
badGateway502 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
badGateway502 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.badGateway502
{-# INLINE badGateway502 #-}
serviceUnavailable503 :: (Set h Status) => h () (Response `With` '[Status])
serviceUnavailable503 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
serviceUnavailable503 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.serviceUnavailable503
{-# INLINE serviceUnavailable503 #-}
gatewayTimeout504 :: (Set h Status) => h () (Response `With` '[Status])
gatewayTimeout504 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
gatewayTimeout504 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.gatewayTimeout504
{-# INLINE gatewayTimeout504 #-}
httpVersionNotSupported505 :: (Set h Status) => h () (Response `With` '[Status])
httpVersionNotSupported505 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
httpVersionNotSupported505 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.httpVersionNotSupported505
{-# INLINE httpVersionNotSupported505 #-}
networkAuthenticationRequired511 :: (Set h Status) => h () (Response `With` '[Status])
networkAuthenticationRequired511 :: forall (h :: * -> * -> *).
Set h Status =>
h () (With Response '[Status])
networkAuthenticationRequired511 = Status -> h () (With Response '[Status])
forall (h :: * -> * -> *).
Set h Status =>
Status -> h () (With Response '[Status])
mkResponse Status
HTTP.networkAuthenticationRequired511
{-# INLINE networkAuthenticationRequired511 #-}