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 (..))
import WebGear.Core.Trait (Linked, Set, Trait (..), linkzero, plant)
newtype Status = Status HTTP.Status
instance Trait Status Response where
type Attribute Status Response = HTTP.Status
mkResponse :: Set h Status Response => HTTP.Status -> h () (Linked '[Status] Response)
mkResponse :: Status -> h () (Linked '[Status] Response)
mkResponse Status
status = proc () -> do
let response :: Linked '[] Response
response = Response -> Linked '[] Response
forall a. a -> Linked '[] a
linkzero (Response -> Linked '[] Response)
-> Response -> Linked '[] Response
forall a b. (a -> b) -> a -> b
$ Status
-> HashMap HeaderName ByteString -> Maybe ByteString -> Response
Response Status
status [] Maybe ByteString
forall a. Maybe a
Nothing
Status
-> h (Linked '[] Response, Attribute Status Response)
(Linked '[Status] Response)
forall t (ts :: [*]) (h :: * -> * -> *) a.
Set h t a =>
t -> h (Linked ts a, Attribute t a) (Linked (t : ts) a)
plant (Status -> Status
Status Status
status) -< (Linked '[] Response
response, Status
status)
continue100 :: Set h Status Response => h () (Linked '[Status] Response)
continue100 :: h () (Linked '[Status] Response)
continue100 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.continue100
switchingProtocols101 :: Set h Status Response => h () (Linked '[Status] Response)
switchingProtocols101 :: h () (Linked '[Status] Response)
switchingProtocols101 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.switchingProtocols101
ok200 :: Set h Status Response => h () (Linked '[Status] Response)
ok200 :: h () (Linked '[Status] Response)
ok200 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.ok200
created201 :: Set h Status Response => h () (Linked '[Status] Response)
created201 :: h () (Linked '[Status] Response)
created201 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.created201
accepted202 :: Set h Status Response => h () (Linked '[Status] Response)
accepted202 :: h () (Linked '[Status] Response)
accepted202 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.accepted202
nonAuthoritative203 :: Set h Status Response => h () (Linked '[Status] Response)
nonAuthoritative203 :: h () (Linked '[Status] Response)
nonAuthoritative203 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.nonAuthoritative203
noContent204 :: Set h Status Response => h () (Linked '[Status] Response)
noContent204 :: h () (Linked '[Status] Response)
noContent204 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.noContent204
resetContent205 :: Set h Status Response => h () (Linked '[Status] Response)
resetContent205 :: h () (Linked '[Status] Response)
resetContent205 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.resetContent205
partialContent206 :: Set h Status Response => h () (Linked '[Status] Response)
partialContent206 :: h () (Linked '[Status] Response)
partialContent206 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.partialContent206
multipleChoices300 :: Set h Status Response => h () (Linked '[Status] Response)
multipleChoices300 :: h () (Linked '[Status] Response)
multipleChoices300 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.multipleChoices300
movedPermanently301 :: Set h Status Response => h () (Linked '[Status] Response)
movedPermanently301 :: h () (Linked '[Status] Response)
movedPermanently301 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.movedPermanently301
found302 :: Set h Status Response => h () (Linked '[Status] Response)
found302 :: h () (Linked '[Status] Response)
found302 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.found302
seeOther303 :: Set h Status Response => h () (Linked '[Status] Response)
seeOther303 :: h () (Linked '[Status] Response)
seeOther303 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.seeOther303
notModified304 :: Set h Status Response => h () (Linked '[Status] Response)
notModified304 :: h () (Linked '[Status] Response)
notModified304 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.notModified304
temporaryRedirect307 :: Set h Status Response => h () (Linked '[Status] Response)
temporaryRedirect307 :: h () (Linked '[Status] Response)
temporaryRedirect307 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.temporaryRedirect307
permanentRedirect308 :: Set h Status Response => h () (Linked '[Status] Response)
permanentRedirect308 :: h () (Linked '[Status] Response)
permanentRedirect308 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.permanentRedirect308
badRequest400 :: Set h Status Response => h () (Linked '[Status] Response)
badRequest400 :: h () (Linked '[Status] Response)
badRequest400 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.badRequest400
unauthorized401 :: Set h Status Response => h () (Linked '[Status] Response)
unauthorized401 :: h () (Linked '[Status] Response)
unauthorized401 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.unauthorized401
paymentRequired402 :: Set h Status Response => h () (Linked '[Status] Response)
paymentRequired402 :: h () (Linked '[Status] Response)
paymentRequired402 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.paymentRequired402
forbidden403 :: Set h Status Response => h () (Linked '[Status] Response)
forbidden403 :: h () (Linked '[Status] Response)
forbidden403 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.forbidden403
notFound404 :: Set h Status Response => h () (Linked '[Status] Response)
notFound404 :: h () (Linked '[Status] Response)
notFound404 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.notFound404
methodNotAllowed405 :: Set h Status Response => h () (Linked '[Status] Response)
methodNotAllowed405 :: h () (Linked '[Status] Response)
methodNotAllowed405 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.methodNotAllowed405
notAcceptable406 :: Set h Status Response => h () (Linked '[Status] Response)
notAcceptable406 :: h () (Linked '[Status] Response)
notAcceptable406 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.notAcceptable406
proxyAuthenticationRequired407 :: Set h Status Response => h () (Linked '[Status] Response)
proxyAuthenticationRequired407 :: h () (Linked '[Status] Response)
proxyAuthenticationRequired407 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.proxyAuthenticationRequired407
requestTimeout408 :: Set h Status Response => h () (Linked '[Status] Response)
requestTimeout408 :: h () (Linked '[Status] Response)
requestTimeout408 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.requestTimeout408
conflict409 :: Set h Status Response => h () (Linked '[Status] Response)
conflict409 :: h () (Linked '[Status] Response)
conflict409 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.conflict409
gone410 :: Set h Status Response => h () (Linked '[Status] Response)
gone410 :: h () (Linked '[Status] Response)
gone410 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.gone410
lengthRequired411 :: Set h Status Response => h () (Linked '[Status] Response)
lengthRequired411 :: h () (Linked '[Status] Response)
lengthRequired411 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.lengthRequired411
preconditionFailed412 :: Set h Status Response => h () (Linked '[Status] Response)
preconditionFailed412 :: h () (Linked '[Status] Response)
preconditionFailed412 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.preconditionFailed412
requestEntityTooLarge413 :: Set h Status Response => h () (Linked '[Status] Response)
requestEntityTooLarge413 :: h () (Linked '[Status] Response)
requestEntityTooLarge413 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.requestEntityTooLarge413
requestURITooLong414 :: Set h Status Response => h () (Linked '[Status] Response)
requestURITooLong414 :: h () (Linked '[Status] Response)
requestURITooLong414 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.requestURITooLong414
unsupportedMediaType415 :: Set h Status Response => h () (Linked '[Status] Response)
unsupportedMediaType415 :: h () (Linked '[Status] Response)
unsupportedMediaType415 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.unsupportedMediaType415
requestedRangeNotSatisfiable416 :: Set h Status Response => h () (Linked '[Status] Response)
requestedRangeNotSatisfiable416 :: h () (Linked '[Status] Response)
requestedRangeNotSatisfiable416 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.requestedRangeNotSatisfiable416
expectationFailed417 :: Set h Status Response => h () (Linked '[Status] Response)
expectationFailed417 :: h () (Linked '[Status] Response)
expectationFailed417 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.expectationFailed417
imATeapot418 :: Set h Status Response => h () (Linked '[Status] Response)
imATeapot418 :: h () (Linked '[Status] Response)
imATeapot418 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.imATeapot418
unprocessableEntity422 :: Set h Status Response => h () (Linked '[Status] Response)
unprocessableEntity422 :: h () (Linked '[Status] Response)
unprocessableEntity422 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.unprocessableEntity422
preconditionRequired428 :: Set h Status Response => h () (Linked '[Status] Response)
preconditionRequired428 :: h () (Linked '[Status] Response)
preconditionRequired428 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.preconditionRequired428
tooManyRequests429 :: Set h Status Response => h () (Linked '[Status] Response)
tooManyRequests429 :: h () (Linked '[Status] Response)
tooManyRequests429 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.tooManyRequests429
requestHeaderFieldsTooLarge431 :: Set h Status Response => h () (Linked '[Status] Response)
= Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.requestHeaderFieldsTooLarge431
internalServerError500 :: Set h Status Response => h () (Linked '[Status] Response)
internalServerError500 :: h () (Linked '[Status] Response)
internalServerError500 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.internalServerError500
notImplemented501 :: Set h Status Response => h () (Linked '[Status] Response)
notImplemented501 :: h () (Linked '[Status] Response)
notImplemented501 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.notImplemented501
badGateway502 :: Set h Status Response => h () (Linked '[Status] Response)
badGateway502 :: h () (Linked '[Status] Response)
badGateway502 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.badGateway502
serviceUnavailable503 :: Set h Status Response => h () (Linked '[Status] Response)
serviceUnavailable503 :: h () (Linked '[Status] Response)
serviceUnavailable503 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.serviceUnavailable503
gatewayTimeout504 :: Set h Status Response => h () (Linked '[Status] Response)
gatewayTimeout504 :: h () (Linked '[Status] Response)
gatewayTimeout504 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.gatewayTimeout504
httpVersionNotSupported505 :: Set h Status Response => h () (Linked '[Status] Response)
httpVersionNotSupported505 :: h () (Linked '[Status] Response)
httpVersionNotSupported505 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.httpVersionNotSupported505
networkAuthenticationRequired511 :: Set h Status Response => h () (Linked '[Status] Response)
networkAuthenticationRequired511 :: h () (Linked '[Status] Response)
networkAuthenticationRequired511 = Status -> h () (Linked '[Status] Response)
forall (h :: * -> * -> *).
Set h Status Response =>
Status -> h () (Linked '[Status] Response)
mkResponse Status
HTTP.networkAuthenticationRequired511