http-kinder-0.2.0.0: Generic kinds and types for working with HTTP

Safe HaskellNone
LanguageHaskell2010

Network.HTTP.Kinder.Status

Contents

Description

Defines the types and kinds for working with type and value level HTTP status codes.

In particular, this module exports a datatype, Status which is meant to be used with DataKinds providing one type, e.g. 'Ok for every common HTTP response status (and an override one CustomStatus). It also exports Sing values for each Status-kinded type each merely being the name of that type prepended with S.

Finally, it exports a set of type synonms for each Status-kinded type so that they can be referenced without the quote prefix '.

Synopsis

Functions and types for working with HeaderName Sings

data SomeStatus where Source

It's difficult to get ahold of values of Status directly since they may contain Nat values which do not exist. Instead, we can get almost the same effect through an existential which holds a singleton at the Status kind

Note that while the Haddocks show this as taking any Sing type it is actually constrained only to have Sings of kind Status.

Constructors

SomeStatus :: forall s. Sing s -> SomeStatus 

httpStatus :: forall sc. Sing sc -> Status Source

Convert a Status Sing-value into a normal http-types Status

statusCode :: forall sc. Sing sc -> Int Source

Get the Int status code for a given Status Sing.

parseStatus :: Int -> SomeStatus Source

Given a particular Int status create a Status Sing to match. Attempts to parse to a meaningful Status Sing but defaults to CustomStatus if necessary.

The Status type/kind

data Status Source

A data type representing HTTP statuses (codes). Much more importantly, with DataKinds enabled this becomes a kind describing types, one for each such status.

It's worth noting that values of this type can be had, but one branch, CustomStatus will not work since it requires Nat values which cannot be had. For this reason prefer using values of SomeStatus instead of values of Status directly.

Instances

SingI Status Continue Source 
SingI Status SwitchingProtocols Source 
SingI Status Ok Source 
SingI Status Created Source 
SingI Status Accepted Source 
SingI Status NonAuthoritiveInformation Source 
SingI Status NoContent Source 
SingI Status ResetContent Source 
SingI Status PartialContent Source 
SingI Status IMUsed Source 
SingI Status MultipleChoices Source 
SingI Status MovedPermanently Source 
SingI Status Found Source 
SingI Status SeeOther Source 
SingI Status NotModified Source 
SingI Status TemporaryRedirect Source 
SingI Status PermanentRedirect Source 
SingI Status BadRequest Source 
SingI Status Unauthorized Source 
SingI Status PaymentRequired Source 
SingI Status Forbidden Source 
SingI Status NotFound Source 
SingI Status MethodNotAllowed Source 
SingI Status NotAcceptable Source 
SingI Status ProxyAuthenticationRequired Source 
SingI Status RequestTimeout Source 
SingI Status Conflict Source 
SingI Status Gone Source 
SingI Status LengthRequired Source 
SingI Status PreconditionFailed Source 
SingI Status PayloadTooLarge Source 
SingI Status RequestURITooLong Source 
SingI Status UnsupportedMediaType Source 
SingI Status RequestedRangeNotSatisfiable Source 
SingI Status ExpectationFailed Source 
SingI Status MisdirectedRequest Source 
SingI Status UnprocessableEntity Source 
SingI Status Locked Source 
SingI Status FailedDependency Source 
SingI Status UpgradeRequired Source 
SingI Status PreconditionRequired Source 
SingI Status TooManyRequests Source 
SingI Status RequestHeaderFieldsTooLarge Source 
SingI Status UnavailableForLegalReasons Source 
SingI Status InternalServerError Source 
SingI Status NotImplemented Source 
SingI Status BadGateway Source 
SingI Status ServiceUnavailable Source 
SingI Status GatewayTimeout Source 
SingI Status HTTPVersionNotSupported Source 
SingI Status VariantAlsoNegotiates Source 
SingI Status InsufficientStorage Source 
SingI Status LoopDetected Source 
SingI Status NotExtended Source 
SingI Status NetworkAuthenticationRequired Source 
SingI Nat i => SingI Status (CustomStatus i) Source 
data Sing Status where Source 

data family Sing a

The singleton kind-indexed data family.

Instances

data Sing Bool where 
data Sing Ordering where 
data Sing Nat where 
data Sing Symbol where 
data Sing () where 
data Sing HeaderName where 
data Sing Verb where 
data Sing Status where 
data Sing [a0] where 
data Sing (Maybe a0) where 
data Sing (TyFun k1 k2 -> *) = SLambda {} 
data Sing (Either a0 b0) where 
data Sing ((,) a0 b0) where 
data Sing ((,,) a0 b0 c0) where 
data Sing ((,,,) a0 b0 c0 d0) where 
data Sing ((,,,,) a0 b0 c0 d0 e0) where 
data Sing ((,,,,,) a0 b0 c0 d0 e0 f0) where 
data Sing ((,,,,,,) a0 b0 c0 d0 e0 f0 g0) where 

Type synonyms for more convenient use of Statuses

type Ok = Ok Source