!"#$%&'()*+,-./0123456789:;<=>?@ABCD E F G H I J K L M N O P Q R S T U V W XYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Safe,DV names a specific tagged context to use for the combinators in the API. (See also in servant-server, Servant.Server.Context.) For example: ntype UseNamedContextAPI = WithNamedContext "myContext" '[String] ( ReqBody '[JSON] Int :> Get '[JSON] Int) Both the ReqBody and Get combinators will use the - with type tag "myContext" as their context.Contexts are only relevant for servant-server.'For more information, see the tutorial.Safe+,05D with 206 status code. with 205 status code. with 205 status code. with 205 status code.  with 205 status code.! with 205 status code." with 204 status code.# with 204 status code.$ with 204 status code.% with 204 status code.& with 204 status code.' with 203 status code.( with 203 status code.) with 203 status code.* with 203 status code.+ with 203 status code., with 202 status code.- with 202 status code.. with 202 status code./ with 202 status code.0 with 202 status code.1 with 201 status code.2 with 200 status code.3 with 200 status code.4 with 200 status code.5 with 200 status code.6 with 200 status code.7Verb is a general type for representing HTTP verbs (a.k.a. methods). For convenience, type synonyms for each verb with a 200 response code are provided, but you are free to define your own:;type Post204 contentTypes a = Verb 'POST 204 contentTypes a' !"#$%&'()*+,-./0123456789:;<=>?@(  !"#$%&'()*+,-./01234567176543210/.-,+*)('&%$#"! @?>=<;:98 & !"#$%&'()*+,-./0123456789:;<=>?@NoneSafe+0DQRB7The contained API (second argument) can be found under  ("/" ++ path)" (path being the first argument).Example:-- GET /hello/world'-- returning a JSON encoded World value4type MyApi = "hello" :> "world" :> Get '[JSON] WorldBBBBB9 Safe+,0DC,Extract the request body as a value of type a.Example:-- POST /booksAtype MyApi = "books" :> ReqBody '[JSON] Book :> Post '[JSON] BookCCCC Safe0DRProvides access to the host or IP address from which the HTTP request was sent.DDDD Safe0E&Endpoint for plugging in your own Wai  Applications. The given  ApplicationY will get the request as received by the server, potentially with a modified (stripped) pathInfo if the  Application is being routed with .:In addition to just letting you plug in your existing WAI  Applications, this can also be used with  ghttps://hackage.haskell.org/package/servant-server/docs/Servant-Utils-StaticFiles.html#v:serveDirectoryserveDirectoryK to serve static files stored in a particular directory on your filesystemEEEE Safe+,0DQRF]Lookup a potentially value-less query string parameter with boolean semantics. If the param sym] is there without any value, or if it's there with value "true" or "1", it's interpreted as ". Otherwise, it's interpreted as .Example:-- /books?publishedCtype MyApi = "books" :> QueryFlag "published" :> Get '[JSON] [Book]G$Lookup the values associated to the symB query string parameter and try to extract it as a value of type [a]K. This is typically meant to support query string parameters of the form param[]=val1&param[]=val2< and so on. Note that servant doesn't actually require the [],s and will fetch the values just fine with param=val1&param=val2, too.Example:5-- /books?authors[]=<author1>&authors[]=<author2>&...Htype MyApi = "books" :> QueryParams "authors" Text :> Get '[JSON] [Book]H#Lookup the value associated to the symB query string parameter and try to extract it as a value of type a.Example:-- /books?author=<author name>Ftype MyApi = "books" :> QueryParam "author" Text :> Get '[JSON] [Book]FGHFGHFHGFGH Safe05I-Was this request made over an SSL connection?UNote that this value will not tell you if the client originally made this request over SSL, but rather whether the current connection is SSL. The distinction lies with reverse proxies. In many cases, the client will connect to a load balancer over SSL, but connect to the WAI handler without SSL. In such a case, the handlers would get K=, but from a user perspective, there is a secure connection.J1the connection to the server is secure (HTTPS)K4the connection to the server is not secure (HTTP)IJKIJKIJKIJKNone  Safe+,02DQ4Extract the given header's value as a value of type a.Example:2newtype Referer = Referer Text deriving (Eq, Show)-- GET /view-my-refererNtype MyApi = "view-my-referer" :> Header "from" Referer :> Get '[JSON] RefererQRSTQRSTQRSTQRSTNone%&+,29:;<=?DQRT\Note: if there are multiple occurences of a header in the argument, the values are interspersed with commas before deserialization (see  <http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2RFC2616 Sec 4.2)akResponse Header objects. You should never need to construct one directly. Instead, use 'addOptionalHeader.cThe underlying value of a adHList of headers.e addHeader` adds a header to a response. Note that it changes the type of the value in the following ways: 'A simple value is wrapped in "Headers [ hdr]":Mlet example1 = addHeader 5 "hi" :: Headers '[Header "someheader" Int] String;getHeaders example1[("someheader","5")] YA value that already has a header has its new header *prepended* to the existing list:Mlet example1 = addHeader 5 "hi" :: Headers '[Header "someheader" Int] String;flet example2 = addHeader True example1 :: Headers '[Header "1st" Bool, Header "someheader" Int] StringgetHeaders example2#[("1st","true"),("someheader","5")]Note that while in your handlers type annotations are not required, since the type can be inferred from the API type, in other cases you may find yourself needing to add annotations.f,Deliberately do not add a header to a value.Ilet example1 = noHeader "hi" :: Headers '[Header "someheader" Int] StringgetHeaders example1[]XYZ[\]^_`abcdefghijklmnXYZ[\]^_`abdcefabcdXef[\YZ]^_`XYZ[\]^_`abcdefghijklmnSafe+,0DpgA generalized Authentication combinator. Use this if you have a non-standard authentication technique.5NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE.ppppNone*+,059;<=DLQRTq*A type for responses without content-body.|YInstantiate this class to register a way of deserializing a type based on the request's  Content-Type header.)import Network.HTTP.Media hiding (Accept)2import qualified Data.ByteString.Lazy.Char8 as BSC)data MyContentType = MyContentType String:{#instance Accept MyContentType whereE contentType _ = "example" // "prs.me.mine" /: ("charset", "utf-8"):}:{5instance Read a => MimeUnrender MyContentType a where- mimeUnrender _ bs = case BSC.take 12 bs ofC "MyContentType" -> return . read . BSC.unpack $ BSC.drop 12 bs8 _ -> Left "didn't start with the magic incantation":}Ftype MyAPI = "path" :> ReqBody '[MyContentType] Int :> Get '[JSON] Int~"Variant which is given the actual  provided by the other party.8In the most cases you don't want to branch based on the . See  3https://github.com/haskell-servant/servant/pull/552pr552 for a motivating example.MInstantiate this class to register a way of serializing a type based on the Accept header.Example: data MyContentType instance Accept MyContentType where contentType _ = "example" // "prs.me.mine" /: ("charset", "utf-8") instance Show a => MimeRender MyContentType a where mimeRender _ val = pack ("This is MINE! " ++ show val) type MyAPI = "path" :> Get '[MyContentType] Int Instances of > represent mimetypes. They are used for matching against the Accept2 HTTP header of the request, and for setting the  Content-Type header of the responseExample:&import Network.HTTP.Media ((//), (/:)) data HTML:{instance Accept HTML where; contentType _ = "text" // "html" /: ("charset", "utf-8"):}Like @ but allows all JSON values instead of just objects and arrays.;Will handle trailing whitespace, but not trailing junk. ie.-eitherDecodeLenient "1 " :: Either String IntRight 11eitherDecodeLenient "1 junk" :: Either String Int1Left "trailing junk after valid JSON: endOfInput" Right . toStrict  Right . id Right . BC.unpack (left show . TextS.decodeUtf8' . toStrict left show . TextL.decodeUtf8'urlDecodeAsForm Note that the *mimeUnrender p (mimeRender p x) == Right x> law only holds if every element of x is non-null (i.e., not ("", "")) eitherDecode id BC.pack fromStrict . TextS.encodeUtf8urlEncodeAsForm Note that the *mimeUnrender p (mimeRender p x) == Right x> law only holds if every element of x is non-null (i.e., not ("", "")) application/octet-stream text/plain;charset=utf-8 !application/x-www-form-urlencoded application/json9qrstuvwxyz{|}~qrstuvwxyz{|}~|}~qryz{wxuvst,qrstuvwxyz{|}~Safe+,0DICapture all remaining values from the request path under a certain type a.Example: -- GET /src/*Jtype MyAPI = "src" :> CaptureAll "segments" Text :> Get '[JSON] SourceFile;Capture a value from the request path under a certain type a.Example:-- GET /books/:isbn?type MyApi = "books" :> Capture "isbn" Text :> Get '[JSON] BookSafe+,0D=A simple datatype to hold data required to decorate a requestCombinator for  -https://tools.ietf.org/html/rfc2617#section-2Basic Access Authentication.6IMPORTANT*: Only use Basic Auth over HTTPS! Credentials are not hashed or encrypted. Note also that because the same credentials are sent on every request, Basic Auth is not as secure as some alternatives. Further, the implementation in servant-server does not protect against some types of timing attacks.QIn Basic Auth, username and password are base64-encoded and transmitted via the  AuthorizationF header. Handshakes are not required, making it relatively efficient.Safe0234QR=Union of two APIs, first takes precedence in case of overlap.Example::{8type MyApi = "books" :> Get '[JSON] [Book] -- GET /booksM :<|> "books" :> ReqBody '[JSON] Book :> Post '[JSON] () -- POST /books:}88None *+,<=DQR HIf both a or b produce an empty constraint, produce an empty constraint.JIf either a or b produce an empty constraint, produce an empty constraint.+Check that a value is an element of a list:,ok (Proxy :: Proxy (Elem Bool '[Int, Bool]))OK.ok (Proxy :: Proxy (Elem String '[Int, Bool]))...... [Char]...'[Int, Bool......Append two type-level lists.Apply (e :>) to every API in xs.Check that every element of xs is an endpoint of api (using ).Aok (Proxy :: Proxy (AllIsIn (Endpoints SampleAPI) SampleAPI)) OKCheck whether sub is a sub API of api.Like  , but uses  rather than .Closed type family, check if endpoint is exactly within api.Aok (Proxy :: Proxy (IsIn ("hello" :> Get '[JSON] Int) SampleAPI))OKUnlike !, this requires an *exact* match.Qok (Proxy :: Proxy (IsIn (Get '[JSON] Int) (Header "h" Bool :> Get '[JSON] Int)))...... Could not deduce......Check that every element of xs is an endpoint of api (using ).Check whether sub is a sub-API of api.Iok (Proxy :: Proxy (IsSubAPI SampleAPI (SampleAPI :<|> Get '[JSON] Int)))OKIok (Proxy :: Proxy (IsSubAPI (SampleAPI :<|> Get '[JSON] Int) SampleAPI))...... Could not deduce...... This uses IsElem0 for checking; thus the note there applies here.Closed type family, check if endpoint is within api. Uses " if it exhausts all other options.Cok (Proxy :: Proxy (IsElem ("hello" :> Get '[JSON] Int) SampleAPI))OKAok (Proxy :: Proxy (IsElem ("bye" :> Get '[JSON] Int) SampleAPI))...... Could not deduce......eAn endpoint is considered within an api even if it is missing combinators that don't affect the URL:Sok (Proxy :: Proxy (IsElem (Get '[JSON] Int) (Header "h" Bool :> Get '[JSON] Int)))OKXok (Proxy :: Proxy (IsElem (Get '[JSON] Int) (ReqBody '[JSON] Bool :> Get '[JSON] Int)))OKN.B.:*  IsElem a bH can be seen as capturing the notion of whether the URL represented by a$ would match the URL represented by b*, *not* whether a request represented by a matches the endpoints serving b (for the latter, use ).You may use this type family to tell the type checker that your custom type may be skipped as part of a link. This is useful for things like HH that are optional in a URI and do not affect them if they are omitted.data CustomThing7type instance IsElem' e (CustomThing :> s) = IsElem e s Note that 0 is called, which will mutually recurse back to ) if it exhausts all other options again.Once you have written a HasLink instance for  CustomThing you are ready to go.%Flatten API into a list of endpoints.Refl :: Endpoints SampleAPI :~: '["hello" :> Verb 'GET 200 '[JSON] Int, "bye" :> (Capture "name" String :> Verb 'POST 200 '[JSON, PlainText] Bool)]ReflNone*+,9;<=?DQRT#Construct a toLink for an endpoint. Query param6A safe link datatype. The only way of constructing a  is using , which means any / is guaranteed to be part of the mentioned API.-Segments of "foo/bar" would be ["foo", "bar"]@Create a valid (by construction) relative URI with query params.%This function will only typecheck if endpoint is part of the API api    -The whole API that this endpoint is a part of+The API endpoint you would like to point to     Noneu    !"#$%&'()*+,-./01234567BCDEFGHIJKQRSTXYZ[\^_`abdcefpqr|}~None,QRNone09;<=?DOQRTLike .Log the contents of P with the function provided as the first argument, and return the value of the WriterT computationLike , but for strict WriterT.Like mmorph's .Like mmorph's .Like mmorph's .Like mmorph's . !"#$%&'&(&)&)*+,*+-*+./01/02/03/04/05/06/06789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc d e f g h i j k l m n o p q q r s t u vwxyz{|}~$      !"#$%&'()*+,-./0./1./2./3./4./5./6./789:8;<=>?=>@=>A=>BC#servant-0.10-4x5xZJwVB0n8ZE0k0fp4T7Servant.API.VerbsServant.API.HttpVersionServant.Utils.EnterServant.Utils.LinksServant.API.VaultServant.API.WithNamedContextServant.API.SubServant.API.ReqBodyServant.API.RemoteHostServant.API.RawServant.API.QueryParamServant.API.IsSecureServant.API.HeaderServant.API.ResponseHeadersServant.API.Experimental.AuthServant.API.ContentTypesServant.API.CaptureServant.API.BasicAuthServant.API.AlternativeServant.API.TypeLevel*Servant.API.Internal.Test.ComprehensiveAPI:> Data.Aeson eitherDecode Servant.API'http-types-0.9.1-DZHEfEDnAxjEEutG9PeGCFNetwork.HTTP.Types.MethodPATCHOPTIONSCONNECTTRACEDELETEPUTHEADPOSTGET StdMethodNetwork.HTTP.Types.Version httpMinor httpMajor HttpVersion1natural-transformation-0.4-EccBWNksrsOH5qWsAPnoy6Control.Natural$$NT:~>*network-uri-2.6.1.0-6PuDgH21OiwGLI4QZ1g9kt Network.URI uriFragmenturiQueryuriPath uriAuthority uriSchemeURI$vault-0.3.0.6-Ku51EF8pSd23Ca05u2pZA1Data.Vault.LazyVaultWithNamedContext ReflectMethod reflectMethodGetPartialContentPutResetContentPatchResetContentDeleteResetContentPostResetContentGetResetContent PutNoContentPatchNoContentDeleteNoContent PostNoContent GetNoContentPutNonAuthoritativePatchNonAuthoritativeDeleteNonAuthoritativePostNonAuthoritativeGetNonAuthoritative PutAccepted PatchAcceptedDeleteAccepted PostAccepted GetAccepted PostCreatedPatchDeletePutPostGetVerb$fReflectMethodStdMethodCONNECT$fReflectMethodStdMethodTRACE$fReflectMethodStdMethodOPTIONS$fReflectMethodStdMethodHEAD$fReflectMethodStdMethodPATCH$fReflectMethodStdMethodDELETE$fReflectMethodStdMethodPUT$fReflectMethodStdMethodPOST$fReflectMethodStdMethodGET $fGenericVerbReqBody RemoteHostRaw QueryFlag QueryParams QueryParamIsSecureSecure NotSecure $fEqIsSecure$fShowIsSecure$fReadIsSecure$fGenericIsSecure $fOrdIsSecureHeader MissingHeaderUndecodableHeader $fEqHeader $fShowHeader$fFunctorHeader AddHeader GetHeaders getHeadersBuildHeadersTobuildHeadersTo HeaderValMapHListHNilHConsHeaders getResponsegetHeadersHList addHeadernoHeader$fAddHeaderhvanew$fAddHeaderhvHeadersHeaders$fGetHeadersHeaders$fGetHeadersHeaders0$fGetHeadersHList$fGetHeadersHList0$fBuildHeadersTo:$fBuildHeadersTo[]$fFunctorHeaders AuthProtect NoContentAllMimeUnrenderallMimeUnrender AllMimeRender allMimeRenderAllMimeallMime AllCTUnrendercanHandleCTypeH handleCTypeH MimeUnrender mimeUnrendermimeUnrenderWithType AllCTRender handleAcceptH MimeRender mimeRender AcceptHeaderAccept contentType contentTypes OctetStreamFormUrlEncoded PlainTextJSONcanHandleAcceptHeitherDecodeLenient'$fMimeUnrenderTYPEOctetStreamByteString($fMimeUnrenderTYPEOctetStreamByteString0$fMimeUnrenderTYPEPlainText[]$fMimeUnrenderTYPEPlainTextText $fMimeUnrenderTYPEPlainTextText0!$fMimeUnrenderTYPEFormUrlEncodeda$fMimeUnrenderTYPEJSONa%$fMimeRenderTYPEOctetStreamByteString&$fMimeRenderTYPEOctetStreamByteString0$fMimeRenderTYPEPlainText[]$fMimeRenderTYPEPlainTextText$fMimeRenderTYPEPlainTextText0$fMimeRenderTYPEFormUrlEncodeda$fMimeRenderTYPEJSONa$fAllMimeUnrender:a$fAllMimeUnrender[]a$fAllMimeRender:NoContent$fAllMimeRender:NoContent0$fAllMimeRender:a$fAllMimeRender:a0 $fAllMime: $fAllMime[]$fAllCTUnrenderctypsa$fAllCTRender:a$fAcceptTYPEOctetStream$fAcceptTYPEPlainText$fAcceptTYPEFormUrlEncoded$fAcceptTYPEJSON$fEqAcceptHeader$fShowAcceptHeader$fReadAcceptHeader$fGenericAcceptHeader$fShowNoContent $fEqNoContent$fReadNoContent$fGenericNoContent CaptureAllCapture BasicAuthDatabasicAuthUsernamebasicAuthPassword BasicAuth:<|> $fMonoid:<|>$fSemigroup:<|>$fEq:<|> $fShow:<|> $fFunctor:<|>$fTraversable:<|>$fFoldable:<|> $fBounded:<|>AndOrElemGoElem IsSubList AppendListMapSubAllIsInIsStrictSubAPIIsIn AllIsElemIsSubAPIIsElemIsElem' EndpointsHasLinkMkLinktoLinkLinklinkURIsafeLink$fHasLinkTYPERaw$fHasLinkTYPEVerb$fHasLinkTYPE:>$fHasLinkTYPE:>0$fHasLinkTYPE:>1$fHasLinkTYPE:>2$fHasLinkTYPE:>3$fHasLinkTYPE:>4$fHasLinkTYPE:>5$fHasLinkTYPE:>6$fHasLinkTYPE:>7$fHasLinkTYPE:>8$fToHttpApiDataLink $fShowParam $fShowLinkComprehensiveAPIWithoutRawComprehensiveAPIcomprehensiveAPIcomprehensiveAPIWithoutRawEnterenterliftNat runReaderTNatevalStateTLNatevalStateTSNatlogWriterTSNatlogWriterTLNathoistNatembedNat squashNat generalizeNat $fEnterm:~>n$fEnter(->)arg(->)$fEnter:<|>arg1:<|>ghc-prim GHC.TypesTrueFalseaddOptionalHeader'http-media-0.6.4-JxgR0ckgcGmHgH0NWw7zys%Network.HTTP.Media.MediaType.Internal MediaTypebytestring-0.10.8.1Data.ByteString.Lazy fromStrict#text-1.2.2.1-9Yh8rJoh8fO2JMLWffT3QsData.Text.Lazy.Encoding encodeUtf8$aeson-1.1.0.0-9sl0MGzYiTN2UYkrsHEkpbencodeParam _segments SingleParamArrayElemParam FlagParamQuery _queryParams addSegment addQueryParamescape)http-api-data-0.3.5-zNN6IU8OsxFWgV5nPWgFJWeb.Internal.HttpApiData ToHttpApiData toUrlPiecetoHeader toQueryParamFromHttpApiData parseUrlPiece parseHeaderparseQueryParamtransformers-0.5.2.0Control.Monad.Trans.Classlift!Control.Monad.Trans.Writer.StrictWriterT#mmorph-1.0.9-7Fxwo0Ga2nU9I92PguUETdControl.Monad.Morphhoistembedsquash generalize