-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | A family of combinators for defining webservices APIs
--   
--   A family of combinators for defining webservices APIs and serving them
--   
--   You can learn about the basics in the tutorial.
--   
--   CHANGELOG
@package servant
@version 0.15

module Servant.API.Alternative

-- | Union of two APIs, first takes precedence in case of overlap.
--   
--   Example:
--   
--   
--   >>> :{
--   type MyApi = "books" :> Get '[JSON] [Book] -- GET /books
--          :<|> "books" :> ReqBody '[JSON] Book :> Post '[JSON] () -- POST /books
--   :}
--   
data a :<|> b
(:<|>) :: a -> b -> (:<|>) a b
infixr 3 :<|>
infixr 3 :<|>
instance (GHC.Enum.Bounded a, GHC.Enum.Bounded b) => GHC.Enum.Bounded (a Servant.API.Alternative.:<|> b)
instance Data.Foldable.Foldable ((Servant.API.Alternative.:<|>) a)
instance Data.Traversable.Traversable ((Servant.API.Alternative.:<|>) a)
instance GHC.Base.Functor ((Servant.API.Alternative.:<|>) a)
instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (a Servant.API.Alternative.:<|> b)
instance (GHC.Classes.Eq a, GHC.Classes.Eq b) => GHC.Classes.Eq (a Servant.API.Alternative.:<|> b)
instance (GHC.Base.Semigroup a, GHC.Base.Semigroup b) => GHC.Base.Semigroup (a Servant.API.Alternative.:<|> b)
instance (GHC.Base.Monoid a, GHC.Base.Monoid b) => GHC.Base.Monoid (a Servant.API.Alternative.:<|> b)
instance Data.Bifoldable.Bifoldable (Servant.API.Alternative.:<|>)
instance Data.Bifunctor.Bifunctor (Servant.API.Alternative.:<|>)
instance Data.Biapplicative.Biapplicative (Servant.API.Alternative.:<|>)
instance Data.Bitraversable.Bitraversable (Servant.API.Alternative.:<|>)

module Servant.API.BasicAuth

-- | Combinator for Basic Access Authentication.
--   
--   
--   
- IMPORTANT*: 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.
--   
--   
--   In Basic Auth, username and password are base64-encoded and
--   transmitted via the Authorization header. Handshakes are not
--   required, making it relatively efficient.
data BasicAuth (realm :: Symbol) (userData :: *)

-- | A simple datatype to hold data required to decorate a request
data BasicAuthData
BasicAuthData :: !ByteString -> !ByteString -> BasicAuthData
[basicAuthUsername] :: BasicAuthData -> !ByteString
[basicAuthPassword] :: BasicAuthData -> !ByteString

module Servant.API.Capture

-- | Capture a value from the request path under a certain type a.
--   
--   Example:
--   
--   
--   >>> -- GET /books/:isbn
--   
--   >>> type MyApi = "books" :> Capture "isbn" Text :> Get '[JSON] Book
--   
type Capture = Capture' '[]

-- | Capture which can be modified. For example with
--   Description.
data Capture' (mods :: [*]) (sym :: Symbol) (a :: *)

-- | Capture all remaining values from the request path under a certain
--   type a.
--   
--   Example:
--   
--   
--   >>> -- GET /src/*
--   
--   >>> type MyAPI = "src" :> CaptureAll "segments" Text :> Get '[JSON] SourceFile
--   
data CaptureAll (sym :: Symbol) (a :: *)

-- | A collection of basic Content-Types (also known as Internet Media
--   Types, or MIME types). Additionally, this module provides classes that
--   encapsulate how to serialize or deserialize values to or from a
--   particular Content-Type.
--   
--   Content-Types are used in ReqBody and the method combinators:
--   
--   
--   >>> type MyEndpoint = ReqBody '[JSON, PlainText] Book :> Get '[JSON, PlainText] Book
--   
--   
--   Meaning the endpoint accepts requests of Content-Type
--   application/json or text/plain;charset-utf8, and
--   returns data in either one of those formats (depending on the
--   Accept header).
--   
--   If you would like to support Content-Types beyond those provided here,
--   then:
--   
--   
--   
- Declare a new data type with no constructors (e.g. data
--   HTML).
--   
- Make an instance of it for Accept.
--   
- If you want to be able to serialize data *into* that Content-Type,
--   make an instance of it for MimeRender.
--   
- If you want to be able to deserialize data *from* that
--   Content-Type, make an instance of it for MimeUnrender.
--   
--   
--   Note that roles are reversed in servant-server and
--   servant-client: to be able to serve (or even typecheck) a
--   Get '[JSON, XML] MyData, you'll need to have the appropriate
--   MimeRender instances in scope, whereas to query that endpoint
--   with servant-client, you'll need a MimeUnrender
--   instance in scope.
module Servant.API.ContentTypes
data JSON
data PlainText
data FormUrlEncoded
data OctetStream

-- | Instances of Accept represent mimetypes. They are used for
--   matching against the Accept HTTP header of the request, and
--   for setting the Content-Type header of the response
--   
--   Example:
--   
--   
--   >>> import Network.HTTP.Media ((//), (/:))
--   
--   >>> data HTML
--   
--   >>> :{
--   instance Accept HTML where
--      contentType _ = "text" // "html" /: ("charset", "utf-8")
--   :}
--   
class Accept ctype
contentType :: Accept ctype => Proxy ctype -> MediaType
contentTypes :: Accept ctype => Proxy ctype -> NonEmpty MediaType

-- | Instantiate 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
--   
class Accept ctype => MimeRender ctype a
mimeRender :: MimeRender ctype a => Proxy ctype -> a -> ByteString

-- | Instantiate this class to register a way of deserializing a type based
--   on the request's Content-Type header.
--   
--   
--   >>> import Network.HTTP.Media hiding (Accept)
--   
--   >>> import qualified Data.ByteString.Lazy.Char8 as BSC
--   
--   >>> data MyContentType = MyContentType String
--   
--   
--   
--   >>> :{
--   instance Accept MyContentType where
--      contentType _ = "example" // "prs.me.mine" /: ("charset", "utf-8")
--   :}
--   
--   
--   
--   >>> :{
--   instance Read a => MimeUnrender MyContentType a where
--      mimeUnrender _ bs = case BSC.take 12 bs of
--        "MyContentType" -> return . read . BSC.unpack $ BSC.drop 12 bs
--        _ -> Left "didn't start with the magic incantation"
--   :}
--   
--   
--   
--   >>> type MyAPI = "path" :> ReqBody '[MyContentType] Int :> Get '[JSON] Int
--   
class Accept ctype => MimeUnrender ctype a
mimeUnrender :: MimeUnrender ctype a => Proxy ctype -> ByteString -> Either String a

-- | Variant which is given the actual MediaType provided by the
--   other party.
--   
--   In the most cases you don't want to branch based on the
--   MediaType. See pr552 for a motivating example.
mimeUnrenderWithType :: MimeUnrender ctype a => Proxy ctype -> MediaType -> ByteString -> Either String a

-- | A type for responses without content-body.
data NoContent
NoContent :: NoContent
newtype AcceptHeader
AcceptHeader :: ByteString -> AcceptHeader
class (AllMime list) => AllCTRender (list :: [*]) a
handleAcceptH :: AllCTRender list a => Proxy list -> AcceptHeader -> a -> Maybe (ByteString, ByteString)
class AllCTUnrender (list :: [*]) a
canHandleCTypeH :: AllCTUnrender list a => Proxy list -> ByteString -> Maybe (ByteString -> Either String a)
handleCTypeH :: AllCTUnrender list a => Proxy list -> ByteString -> ByteString -> Maybe (Either String a)
class AllMime (list :: [*])
allMime :: AllMime list => Proxy list -> [MediaType]
class (AllMime list) => AllMimeRender (list :: [*]) a
allMimeRender :: AllMimeRender list a => Proxy list -> a -> [(MediaType, ByteString)]
class (AllMime list) => AllMimeUnrender (list :: [*]) a
allMimeUnrender :: AllMimeUnrender list a => Proxy list -> [(MediaType, ByteString -> Either String a)]

-- | Like eitherDecode but allows all JSON values instead of just
--   objects and arrays.
--   
--   Will handle trailing whitespace, but not trailing junk. ie.
--   
--   
--   >>> eitherDecodeLenient "1 " :: Either String Int
--   Right 1
--   
--   
--   
--   >>> eitherDecodeLenient "1 junk" :: Either String Int
--   Left "trailing junk after valid JSON: endOfInput"
--   
eitherDecodeLenient :: FromJSON a => ByteString -> Either String a
canHandleAcceptH :: AllMime list => Proxy list -> AcceptHeader -> Bool
instance GHC.Generics.Generic Servant.API.ContentTypes.NoContent
instance GHC.Read.Read Servant.API.ContentTypes.NoContent
instance GHC.Classes.Eq Servant.API.ContentTypes.NoContent
instance GHC.Show.Show Servant.API.ContentTypes.NoContent
instance GHC.Generics.Generic Servant.API.ContentTypes.AcceptHeader
instance GHC.Read.Read Servant.API.ContentTypes.AcceptHeader
instance GHC.Show.Show Servant.API.ContentTypes.AcceptHeader
instance GHC.Classes.Eq Servant.API.ContentTypes.AcceptHeader
instance Servant.API.ContentTypes.Accept ctyp => Servant.API.ContentTypes.AllMimeRender '[ctyp] Servant.API.ContentTypes.NoContent
instance Servant.API.ContentTypes.AllMime (ctyp : ctyp' : ctyps) => Servant.API.ContentTypes.AllMimeRender (ctyp : ctyp' : ctyps) Servant.API.ContentTypes.NoContent
instance Servant.API.ContentTypes.AllMimeUnrender ctyps a => Servant.API.ContentTypes.AllCTUnrender ctyps a
instance Servant.API.ContentTypes.AllMimeUnrender '[] a
instance (Servant.API.ContentTypes.MimeUnrender ctyp a, Servant.API.ContentTypes.AllMimeUnrender ctyps a) => Servant.API.ContentTypes.AllMimeUnrender (ctyp : ctyps) a
instance (Servant.API.ContentTypes.Accept ct, Servant.API.ContentTypes.AllMime cts, Servant.API.ContentTypes.AllMimeRender (ct : cts) a) => Servant.API.ContentTypes.AllCTRender (ct : cts) a
instance Servant.API.ContentTypes.MimeRender ctyp a => Servant.API.ContentTypes.AllMimeRender '[ctyp] a
instance (Servant.API.ContentTypes.MimeRender ctyp a, Servant.API.ContentTypes.AllMimeRender (ctyp' : ctyps) a) => Servant.API.ContentTypes.AllMimeRender (ctyp : ctyp' : ctyps) a
instance (TypeError ...) => Servant.API.ContentTypes.AllCTRender '[] ()
instance Servant.API.ContentTypes.AllMime '[]
instance (Servant.API.ContentTypes.Accept ctyp, Servant.API.ContentTypes.AllMime ctyps) => Servant.API.ContentTypes.AllMime (ctyp : ctyps)
instance Data.Aeson.Types.FromJSON.FromJSON a => Servant.API.ContentTypes.MimeUnrender Servant.API.ContentTypes.JSON a
instance Web.Internal.FormUrlEncoded.FromForm a => Servant.API.ContentTypes.MimeUnrender Servant.API.ContentTypes.FormUrlEncoded a
instance Servant.API.ContentTypes.MimeUnrender Servant.API.ContentTypes.PlainText Data.Text.Internal.Lazy.Text
instance Servant.API.ContentTypes.MimeUnrender Servant.API.ContentTypes.PlainText Data.Text.Internal.Text
instance Servant.API.ContentTypes.MimeUnrender Servant.API.ContentTypes.PlainText GHC.Base.String
instance Servant.API.ContentTypes.MimeUnrender Servant.API.ContentTypes.OctetStream Data.ByteString.Lazy.Internal.ByteString
instance Servant.API.ContentTypes.MimeUnrender Servant.API.ContentTypes.OctetStream Data.ByteString.Internal.ByteString
instance Data.Aeson.Types.ToJSON.ToJSON a => Servant.API.ContentTypes.MimeRender Servant.API.ContentTypes.JSON a
instance Web.Internal.FormUrlEncoded.ToForm a => Servant.API.ContentTypes.MimeRender Servant.API.ContentTypes.FormUrlEncoded a
instance Servant.API.ContentTypes.MimeRender Servant.API.ContentTypes.PlainText Data.Text.Internal.Lazy.Text
instance Servant.API.ContentTypes.MimeRender Servant.API.ContentTypes.PlainText Data.Text.Internal.Text
instance Servant.API.ContentTypes.MimeRender Servant.API.ContentTypes.PlainText GHC.Base.String
instance Servant.API.ContentTypes.MimeRender Servant.API.ContentTypes.OctetStream Data.ByteString.Lazy.Internal.ByteString
instance Servant.API.ContentTypes.MimeRender Servant.API.ContentTypes.OctetStream Data.ByteString.Internal.ByteString
instance Servant.API.ContentTypes.Accept Servant.API.ContentTypes.JSON
instance Servant.API.ContentTypes.Accept Servant.API.ContentTypes.FormUrlEncoded
instance Servant.API.ContentTypes.Accept Servant.API.ContentTypes.PlainText
instance Servant.API.ContentTypes.Accept Servant.API.ContentTypes.OctetStream

module Servant.API.Description

-- | Add more verbose description for (part of) API.
--   
--   Example:
--   
--   
--   >>> :{
--   type MyApi = Description
--    "This comment is visible in multiple Servant interpretations \
--    \and can be really long if necessary. \
--    \Haskell multiline support is not perfect \
--    \but it's still very readable."
--   :> Get '[JSON] Book
--   :}
--   
data Description (sym :: Symbol)

-- | Add a short summary for (part of) API.
--   
--   Example:
--   
--   
--   >>> type MyApi = Summary "Get book by ISBN." :> "books" :> Capture "isbn" Text :> Get '[JSON] Book
--   
data Summary (sym :: Symbol)

-- | Fold modifier list to decide whether argument should be parsed
--   strictly or leniently.
--   
--   
--   >>> :kind! FoldDescription '[]
--   FoldDescription '[] :: Symbol
--   = ""
--   
--   
--   
--   >>> :kind! FoldDescription '[Required, Description "foobar", Lenient]
--   FoldDescription '[Required, Description "foobar", Lenient] :: Symbol
--   = "foobar"
--   
type FoldDescription mods = FoldDescription' "" mods

-- | Implementation of FoldDescription.
type family FoldDescription' (acc :: Symbol) (mods :: [*]) :: Symbol

-- | Reflect description to the term level.
--   
--   
--   >>> reflectDescription (Proxy :: Proxy '[Required, Description "foobar", Lenient])
--   "foobar"
--   
reflectDescription :: forall mods. KnownSymbol (FoldDescription mods) => Proxy mods -> String

module Servant.API.Empty

-- | An empty API: one which serves nothing. Morally speaking, this should
--   be the unit of :<|>. Implementors of interpretations of
--   API types should treat EmptyAPI as close to the unit as
--   possible.
data EmptyAPI
EmptyAPI :: EmptyAPI
instance GHC.Enum.Enum Servant.API.Empty.EmptyAPI
instance GHC.Enum.Bounded Servant.API.Empty.EmptyAPI
instance GHC.Show.Show Servant.API.Empty.EmptyAPI
instance GHC.Classes.Eq Servant.API.Empty.EmptyAPI

module Servant.API.Experimental.Auth

-- | A generalized Authentication combinator. Use this if you have a
--   non-standard authentication technique.
--   
--   NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE.
data AuthProtect (tag :: k)

-- | Define servant servers from record types. Generics for the win.
--   
--   The usage is simple, if you only need a collection of routes. First
--   you define a record with field types prefixed by a parameter
--   route:
--   
--   
--   data Routes route = Routes
--       { _get :: route :- Capture "id" Int :> Get '[JSON] String
--       , _put :: route :- ReqBody '[JSON] Int :> Put '[JSON] Bool
--       }
--     deriving (Generic)
--   
--   
--   You can get a Proxy of the server using
--   
--   
--   api :: Proxy (ToServantApi Routes)
--   api = genericApi (Proxy :: Proxy Routes)
--   
--   
--   Using genericApi is better as it checks that instances exists,
--   i.e. you get better error messages than simply using Proxy
--   value.
--   
--   Note: in 0.14 series this module isn't re-exported from
--   API.
--   
--   Servant.API.Generic is based on servant-generic
--   package by Patrick Chilton
module Servant.API.Generic

-- | A class with a type family that applies an appropriate type family to
--   the api parameter. For example, AsApi will leave
--   api untouched, while AsServerT m will
--   produce ServerT api m.
class GenericMode mode where {
    type family mode :- api :: *;
}
infixl 0 :-

-- | A constraint alias, for work with mode and routes.
type GenericServant routes mode = (GenericMode mode, Generic (routes mode), GServantProduct (Rep (routes mode)))

-- | Turns a generic product type into a tree of :<|>
--   combinators.
type ToServant routes mode = GToServant (Rep (routes mode))

-- | See ToServant, but at value-level.
toServant :: GenericServant routes mode => routes mode -> ToServant routes mode

-- | Inverse of toServant.
--   
--   This can be used to turn generated values such as client
--   functions into records.
--   
--   You may need to provide a type signature for the output type
--   (your record type).
fromServant :: GenericServant routes mode => ToServant routes mode -> routes mode

-- | A type that specifies that an API record contains an API definition.
--   Only useful at type-level.
data AsApi
type ToServantApi routes = ToServant routes AsApi

-- | Get a Proxy of an API type.
genericApi :: GenericServant routes AsApi => Proxy routes -> Proxy (ToServantApi routes)
class GServantProduct f

-- | Representable types of kind *. This class is derivable in GHC
--   with the DeriveGeneric flag on.
--   
--   A Generic instance must satisfy the following laws:
--   
--   
--   from . to ≡ id
--   to . from ≡ id
--   
class Generic a where {
    
    -- | Generic representation type
    type family Rep a :: Type -> Type;
}
instance Servant.API.Generic.GServantProduct f => Servant.API.Generic.GServantProduct (GHC.Generics.M1 i c f)
instance (Servant.API.Generic.GServantProduct l, Servant.API.Generic.GServantProduct r) => Servant.API.Generic.GServantProduct (l GHC.Generics.:*: r)
instance Servant.API.Generic.GServantProduct (GHC.Generics.K1 i c)
instance Servant.API.Generic.GenericMode Servant.API.Generic.AsApi

module Servant.API.HttpVersion

-- | HTTP Version.
--   
--   Note that the Show instance is intended merely for debugging.
data HttpVersion
HttpVersion :: !Int -> !Int -> HttpVersion
[httpMajor] :: HttpVersion -> !Int
[httpMinor] :: HttpVersion -> !Int

module Servant.API.IsSecure

-- | Was this request made over an SSL connection?
--   
--   Note 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
--   NotSecure, but from a user perspective, there is a secure
--   connection.
data IsSecure

-- | the connection to the server is secure (HTTPS)
Secure :: IsSecure

-- | the connection to the server is not secure (HTTP)
NotSecure :: IsSecure
instance GHC.Classes.Ord Servant.API.IsSecure.IsSecure
instance GHC.Generics.Generic Servant.API.IsSecure.IsSecure
instance GHC.Read.Read Servant.API.IsSecure.IsSecure
instance GHC.Show.Show Servant.API.IsSecure.IsSecure
instance GHC.Classes.Eq Servant.API.IsSecure.IsSecure

module Servant.API.Modifiers

-- | Required argument. Not wrapped.
data Required

-- | Optional argument. Wrapped in Maybe.
data Optional

-- | Fold modifier list to decide whether argument is required.
--   
--   
--   >>> :kind! FoldRequired '[Required, Description "something"]
--   FoldRequired '[Required, Description "something"] :: Bool
--   = 'True
--   
--   
--   
--   >>> :kind! FoldRequired '[Required, Optional]
--   FoldRequired '[Required, Optional] :: Bool
--   = 'False
--   
--   
--   
--   >>> :kind! FoldRequired '[]
--   FoldRequired '[] :: Bool
--   = 'False
--   
type FoldRequired mods = FoldRequired'  'False mods

-- | Implementation of FoldRequired.
type family FoldRequired' (acc :: Bool) (mods :: [*]) :: Bool

-- | Leniently parsed argument, i.e. parsing never fail. Wrapped in
--   Either Text.
data Lenient

-- | Strictly parsed argument. Not wrapped.
data Strict

-- | Fold modifier list to decide whether argument should be parsed
--   strictly or leniently.
--   
--   
--   >>> :kind! FoldLenient '[]
--   FoldLenient '[] :: Bool
--   = 'False
--   
type FoldLenient mods = FoldLenient'  'False mods

-- | Implementation of FoldLenient.
type family FoldLenient' (acc :: Bool) (mods :: [*]) :: Bool

-- | Helper type alias.
--   
--   
--   
- Required ↦ a
--   
- Optional ↦ Maybe a
--   
type RequiredArgument mods a = If (FoldRequired mods) a (Maybe a)

-- | Fold a RequiredAgument into a value
foldRequiredArgument :: forall mods a r. SBoolI (FoldRequired mods) => Proxy mods -> (a -> r) -> (Maybe a -> r) -> RequiredArgument mods a -> r

-- | Unfold a value into a RequiredArgument.
unfoldRequiredArgument :: forall mods m a. (Monad m, SBoolI (FoldRequired mods), SBoolI (FoldLenient mods)) => Proxy mods -> m (RequiredArgument mods a) -> (Text -> m (RequiredArgument mods a)) -> Maybe (Either Text a) -> m (RequiredArgument mods a)

-- | Helper type alias.
--   
--   By default argument is Optional and Strict.
--   
--   
--   
- Required, Strict ↦ a
--   
- Required, Lenient ↦ Either Text
--   a
--   
- Optional, Strict ↦ Maybe a
--   
- Optional, Lenient ↦ Maybe (Either
--   Text a)
--   
type RequestArgument mods a = If (FoldRequired mods) (If (FoldLenient mods) (Either Text a) a) (Maybe (If (FoldLenient mods) (Either Text a) a))

-- | Unfold a value into a RequestArgument.
unfoldRequestArgument :: forall mods m a. (Monad m, SBoolI (FoldRequired mods), SBoolI (FoldLenient mods)) => Proxy mods -> m (RequestArgument mods a) -> (Text -> m (RequestArgument mods a)) -> Maybe (Either Text a) -> m (RequestArgument mods a)

module Servant.API.Header

-- | Extract the given header's value as a value of type a. I.e.
--   header sent by client, parsed by server.
--   
--   Example:
--   
--   
--   >>> newtype Referer = Referer Text deriving (Eq, Show)
--   
--   >>> 
--   
--   >>> -- GET /view-my-referer
--   
--   >>> type MyApi = "view-my-referer" :> Header "from" Referer :> Get '[JSON] Referer
--   
type Header = Header' '[Optional, Strict]
data Header' (mods :: [*]) (sym :: Symbol) a

module Servant.API.QueryParam

-- | 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 True.
--   Otherwise, it's interpreted as False.
--   
--   Example:
--   
--   
--   >>> -- /books?published
--   
--   >>> type MyApi = "books" :> QueryFlag "published" :> Get '[JSON] [Book]
--   
data QueryFlag (sym :: Symbol)

-- | Lookup the value associated to the sym query string parameter
--   and try to extract it as a value of type a.
--   
--   Example:
--   
--   
--   >>> -- /books?author=<author name>
--   
--   >>> type MyApi = "books" :> QueryParam "author" Text :> Get '[JSON] [Book]
--   
type QueryParam = QueryParam' '[Optional, Strict]

-- | QueryParam which can be Required, Lenient, or
--   modified otherwise.
data QueryParam' (mods :: [*]) (sym :: Symbol) (a :: *)

-- | Lookup the values associated to the sym query string
--   parameter and try to extract it as a value of type [a]. 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:
--   
--   
--   >>> -- /books?authors[]=<author1>&authors[]=<author2>&...
--   
--   >>> type MyApi = "books" :> QueryParams "authors" Text :> Get '[JSON] [Book]
--   
data QueryParams (sym :: Symbol) (a :: *)

module Servant.API.Raw

-- | Endpoint for plugging in your own Wai Applications.
--   
--   The given Application 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
--   serveDirectory to serve static files stored in a particular
--   directory on your filesystem
data Raw

module Servant.API.RemoteHost

-- | Provides access to the host or IP address from which the HTTP request
--   was sent.
data RemoteHost

module Servant.API.ReqBody

-- | Extract the request body as a value of type a.
--   
--   Example:
--   
--   
--   >>> -- POST /books
--   
--   >>> type MyApi = "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book
--   
type ReqBody = ReqBody' '[Required, Strict]

-- | Note: ReqBody' is always Required.
data ReqBody' (mods :: [*]) (contentTypes :: [*]) (a :: *)

-- | This module provides facilities for adding headers to a response.
--   
--   
--   >>> let headerVal = addHeader "some-url" 5 :: Headers '[Header "Location" String] Int
--   
--   
--   The value is added to the header specified by the type
--   (Location in the example above).
module Servant.API.ResponseHeaders

-- | Response Header objects. You should never need to construct one
--   directly. Instead, use addOptionalHeader.
data Headers ls a
Headers :: a -> HList ls -> Headers ls a

-- | The underlying value of a Headers
[getResponse] :: Headers ls a -> a

-- | HList of headers.
[getHeadersHList] :: Headers ls a -> HList ls
data ResponseHeader (sym :: Symbol) a
Header :: a -> ResponseHeader a
MissingHeader :: ResponseHeader a
UndecodableHeader :: ByteString -> ResponseHeader a
class AddHeader h v orig new | h v orig -> new, new -> h, new -> v, new -> orig

-- | 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]":
--   
--   
--   
--   >>> let example1 = addHeader 5 "hi" :: Headers '[Header "someheader" Int] String;
--   
--   >>> getHeaders example1
--   [("someheader","5")]
--   
--   
--   
--   
- A value that already has a header has its new header *prepended*
--   to the existing list:
--   
--   
--   
--   >>> let example1 = addHeader 5 "hi" :: Headers '[Header "someheader" Int] String;
--   
--   >>> let example2 = addHeader True example1 :: Headers '[Header "1st" Bool, Header "someheader" Int] String
--   
--   >>> getHeaders 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.
addHeader :: AddHeader h v orig new => v -> orig -> new

-- | Deliberately do not add a header to a value.
--   
--   
--   >>> let example1 = noHeader "hi" :: Headers '[Header "someheader" Int] String
--   
--   >>> getHeaders example1
--   []
--   
noHeader :: AddHeader h v orig new => orig -> new
class HasResponseHeader h a headers

-- | Look up a specific ResponseHeader, without having to know what
--   position it is in the HList.
--   
--   
--   >>> let example1 = addHeader 5 "hi" :: Headers '[Header "someheader" Int] String
--   
--   >>> let example2 = addHeader True example1 :: Headers '[Header "1st" Bool, Header "someheader" Int] String
--   
--   >>> lookupResponseHeader example2 :: ResponseHeader "someheader" Int
--   Header 5
--   
--   
--   
--   >>> lookupResponseHeader example2 :: ResponseHeader "1st" Bool
--   Header True
--   
--   
--   Usage of this function relies on an explicit type annotation of the
--   header to be looked up. This can be done with type annotations on the
--   result, or with an explicit type application. In this example, the
--   type of header value is determined by the type-inference, we only
--   specify the name of the header:
--   
--   
--   >>> :set -XTypeApplications
--   
--   >>> case lookupResponseHeader @"1st" example2 of { Header b -> b ; _ -> False }
--   True
--   
lookupResponseHeader :: HasResponseHeader h a headers => Headers headers r -> ResponseHeader h a
class BuildHeadersTo hs

-- | Note: if there are multiple occurences of a header in the argument,
--   the values are interspersed with commas before deserialization (see
--   RFC2616 Sec 4.2)
buildHeadersTo :: BuildHeadersTo hs => [Header] -> HList hs
class GetHeaders ls
getHeaders :: GetHeaders ls => ls -> [Header]

-- | Auxiliary class for GetHeaders (Headers hs a)
--   instance
class GetHeaders' hs
type family HeaderValMap (f :: * -> *) (xs :: [*])
data HList a
[HNil] :: HList '[]
[HCons] :: ResponseHeader h x -> HList xs -> HList (Header h x : xs)
instance GHC.Base.Functor (Servant.API.ResponseHeaders.Headers ls)
instance GHC.Base.Functor (Servant.API.ResponseHeaders.ResponseHeader sym)
instance GHC.Show.Show a => GHC.Show.Show (Servant.API.ResponseHeaders.ResponseHeader sym a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Servant.API.ResponseHeaders.ResponseHeader sym a)
instance Servant.API.ResponseHeaders.HasResponseHeader h a (Servant.API.Header.Header h a : rest)
instance Servant.API.ResponseHeaders.HasResponseHeader h a rest => Servant.API.ResponseHeaders.HasResponseHeader h a (first : rest)
instance (GHC.TypeLits.KnownSymbol h, Web.Internal.HttpApiData.ToHttpApiData v) => Servant.API.ResponseHeaders.AddHeader h v (Servant.API.ResponseHeaders.Headers (fst : rest) a) (Servant.API.ResponseHeaders.Headers (Servant.API.Header.Header h v : fst : rest) a)
instance (GHC.TypeLits.KnownSymbol h, Web.Internal.HttpApiData.ToHttpApiData v, new Data.Type.Equality.~ Servant.API.ResponseHeaders.Headers '[Servant.API.Header.Header h v] a) => Servant.API.ResponseHeaders.AddHeader h v a new
instance Servant.API.ResponseHeaders.GetHeaders' hs => Servant.API.ResponseHeaders.GetHeaders (Servant.API.ResponseHeaders.Headers hs a)
instance Servant.API.ResponseHeaders.GetHeaders' '[]
instance (GHC.TypeLits.KnownSymbol h, Servant.API.ResponseHeaders.GetHeadersFromHList rest, Web.Internal.HttpApiData.ToHttpApiData v) => Servant.API.ResponseHeaders.GetHeaders' (Servant.API.Header.Header h v : rest)
instance Servant.API.ResponseHeaders.GetHeadersFromHList hs => Servant.API.ResponseHeaders.GetHeaders (Servant.API.ResponseHeaders.HList hs)
instance Servant.API.ResponseHeaders.GetHeadersFromHList '[]
instance (GHC.TypeLits.KnownSymbol h, Web.Internal.HttpApiData.ToHttpApiData x, Servant.API.ResponseHeaders.GetHeadersFromHList xs) => Servant.API.ResponseHeaders.GetHeadersFromHList (Servant.API.Header.Header h x : xs)
instance Servant.API.ResponseHeaders.BuildHeadersTo '[]
instance (Web.Internal.HttpApiData.FromHttpApiData v, Servant.API.ResponseHeaders.BuildHeadersTo xs, GHC.TypeLits.KnownSymbol h) => Servant.API.ResponseHeaders.BuildHeadersTo (Servant.API.Header.Header h v : xs)

module Servant.API.Sub

-- | The contained API (second argument) can be found under ("/" ++
--   path) (path being the first argument).
--   
--   Example:
--   
--   
--   >>> -- GET /hello/world
--   
--   >>> -- returning a JSON encoded World value
--   
--   >>> type MyApi = "hello" :> "world" :> Get '[JSON] World
--   
data (path :: k) :> (a :: *)
infixr 4 :>

module Servant.API.Vault

-- | A persistent store for values of arbitrary types.
--   
--   This variant is the simplest and creates keys in the IO monad.
--   See the module Data.Vault.ST if you want to use it with the
--   ST monad instead.
type Vault = Vault RealWorld

module Servant.API.Verbs
class ReflectMethod a
reflectMethod :: ReflectMethod a => Proxy a -> Method

-- | GET with 206 status code.
type GetPartialContent = Verb  'GET 206

-- | PUT with 205 status code.
type PutResetContent = Verb  'PUT 205

-- | PATCH with 205 status code.
type PatchResetContent = Verb  'PATCH 205

-- | DELETE with 205 status code.
type DeleteResetContent = Verb  'DELETE 205

-- | POST with 205 status code.
type PostResetContent = Verb  'POST 205

-- | GET with 205 status code.
type GetResetContent = Verb  'GET 205

-- | PUT with 204 status code.
type PutNoContent = Verb  'PUT 204

-- | PATCH with 204 status code.
type PatchNoContent = Verb  'PATCH 204

-- | DELETE with 204 status code.
type DeleteNoContent = Verb  'DELETE 204

-- | POST with 204 status code.
type PostNoContent = Verb  'POST 204

-- | GET with 204 status code.
type GetNoContent = Verb  'GET 204

-- | PUT with 203 status code.
type PutNonAuthoritative = Verb  'PUT 203

-- | PATCH with 203 status code.
type PatchNonAuthoritative = Verb  'PATCH 203

-- | DELETE with 203 status code.
type DeleteNonAuthoritative = Verb  'DELETE 203

-- | POST with 203 status code.
type PostNonAuthoritative = Verb  'POST 203

-- | GET with 203 status code.
type GetNonAuthoritative = Verb  'GET 203

-- | PUT with 202 status code.
type PutAccepted = Verb  'PUT 202

-- | PATCH with 202 status code.
type PatchAccepted = Verb  'PATCH 202

-- | DELETE with 202 status code.
type DeleteAccepted = Verb  'DELETE 202

-- | POST with 202 status code.
type PostAccepted = Verb  'POST 202

-- | GET with 202 status code.
type GetAccepted = Verb  'GET 202

-- | PUT with 201 status code.
type PutCreated = Verb  'PUT 201

-- | POST with 201 status code.
type PostCreated = Verb  'POST 201

-- | PATCH with 200 status code.
type Patch = Verb  'PATCH 200

-- | DELETE with 200 status code.
type Delete = Verb  'DELETE 200

-- | PUT with 200 status code.
type Put = Verb  'PUT 200

-- | POST with 200 status code.
type Post = Verb  'POST 200

-- | GET with 200 status code.
type Get = Verb  'GET 200

-- | Verb 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
--   
data Verb (method :: k1) (statusCode :: Nat) (contentTypes :: [*]) (a :: *)

-- | HTTP standard method (as defined by RFC 2616, and PATCH which is
--   defined by RFC 5789).
data StdMethod
GET :: StdMethod
POST :: StdMethod
HEAD :: StdMethod
PUT :: StdMethod
DELETE :: StdMethod
TRACE :: StdMethod
CONNECT :: StdMethod
OPTIONS :: StdMethod
PATCH :: StdMethod
instance forall k1 (method :: k1) (statusCode :: GHC.Types.Nat) (contentTypes :: [*]) a. GHC.Generics.Generic (Servant.API.Verbs.Verb method statusCode contentTypes a)
instance Servant.API.Verbs.ReflectMethod 'Network.HTTP.Types.Method.GET
instance Servant.API.Verbs.ReflectMethod 'Network.HTTP.Types.Method.POST
instance Servant.API.Verbs.ReflectMethod 'Network.HTTP.Types.Method.PUT
instance Servant.API.Verbs.ReflectMethod 'Network.HTTP.Types.Method.DELETE
instance Servant.API.Verbs.ReflectMethod 'Network.HTTP.Types.Method.PATCH
instance Servant.API.Verbs.ReflectMethod 'Network.HTTP.Types.Method.HEAD
instance Servant.API.Verbs.ReflectMethod 'Network.HTTP.Types.Method.OPTIONS
instance Servant.API.Verbs.ReflectMethod 'Network.HTTP.Types.Method.TRACE
instance Servant.API.Verbs.ReflectMethod 'Network.HTTP.Types.Method.CONNECT

-- | This module collects utilities for manipulating servant API
--   types. The functionality in this module is for advanced usage.
--   
--   The code samples in this module use the following type synonym:
--   
--   
--   type SampleAPI = "hello" :> Get '[JSON] Int
--               :<|> "bye" :> Capture "name" String :> Post '[JSON, PlainText] Bool
--   
module Servant.API.TypeLevel

-- | 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)]
--   Refl
--   
type family Endpoints api

-- | 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
--   QueryParam that are optional in a URI and do not
--   affect them if they are omitted.
--   
--   
--   >>> data CustomThing
--   
--   >>> type instance IsElem' e (CustomThing :> s) = IsElem e s
--   
--   
--   Note that IsElem is called, which will mutually
--   recurse back to IsElem' if it exhausts all other
--   options again.
--   
--   Once you have written a HasLink instance for
--   CustomThing you are ready to go.
type family IsElem' a s :: Constraint

-- | Closed type family, check if endpoint is within api.
--   Uses IsElem' if it exhausts all other options.
--   
--   
--   >>> ok (Proxy :: Proxy (IsElem ("hello" :> Get '[JSON] Int) SampleAPI))
--   OK
--   
--   
--   
--   >>> ok (Proxy :: Proxy (IsElem ("bye" :> Get '[JSON] Int) SampleAPI))
--   ...
--   ... Could not deduce...
--   ...
--   
--   
--   An endpoint is considered within an api even if it is missing
--   combinators that don't affect the URL:
--   
--   
--   >>> ok (Proxy :: Proxy (IsElem (Get '[JSON] Int) (Header "h" Bool :> Get '[JSON] Int)))
--   OK
--   
--   
--   
--   >>> ok (Proxy :: Proxy (IsElem (Get '[JSON] Int) (ReqBody '[JSON] Bool :> Get '[JSON] Int)))
--   OK
--   
--   
--   
--   
- N.B.:* IsElem a b 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 IsIn).
--   
type family IsElem endpoint api :: Constraint

-- | Check whether sub is a sub-API of api.
--   
--   
--   >>> ok (Proxy :: Proxy (IsSubAPI SampleAPI (SampleAPI :<|> Get '[JSON] Int)))
--   OK
--   
--   
--   
--   >>> ok (Proxy :: Proxy (IsSubAPI (SampleAPI :<|> Get '[JSON] Int) SampleAPI))
--   ...
--   ... Could not deduce...
--   ...
--   
--   
--   This uses IsElem for checking; thus the note there applies
--   here.
type family IsSubAPI sub api :: Constraint

-- | Check that every element of xs is an endpoint of api
--   (using IsElem).
type family AllIsElem xs api :: Constraint

-- | Closed type family, check if endpoint is exactly within
--   api.
--   
--   
--   >>> ok (Proxy :: Proxy (IsIn ("hello" :> Get '[JSON] Int) SampleAPI))
--   OK
--   
--   
--   Unlike IsElem, this requires an *exact* match.
--   
--   
--   >>> ok (Proxy :: Proxy (IsIn (Get '[JSON] Int) (Header "h" Bool :> Get '[JSON] Int)))
--   ...
--   ... Could not deduce...
--   ...
--   
type family IsIn (endpoint :: *) (api :: *) :: Constraint

-- | Check whether sub is a sub API of api.
--   
--   Like IsSubAPI, but uses IsIn rather than IsElem.
type family IsStrictSubAPI sub api :: Constraint

-- | Check that every element of xs is an endpoint of api
--   (using IsIn).
--   
--   ok (Proxy :: Proxy (AllIsIn (Endpoints SampleAPI) SampleAPI)) OK
type family AllIsIn xs api :: Constraint

-- | Apply (e :>) to every API in xs.
type family MapSub e xs

-- | Append two type-level lists.
type family AppendList xs ys
type family IsSubList a b :: 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...
--   ...
--   
type Elem e es = ElemGo e es es
type family ElemGo e es orig :: Constraint

-- | If either a or b produce an empty constraint, produce an empty
--   constraint.
type family Or (a :: Constraint) (b :: Constraint) :: Constraint

-- | If both a or b produce an empty constraint, produce an empty
--   constraint.
type family And (a :: Constraint) (b :: Constraint) :: Constraint

module Servant.API.WithNamedContext

-- | WithNamedContext names a specific tagged context to use for the
--   combinators in the API. (See also in servant-server,
--   Servant.Server.Context.) For example:
--   
--   
--   type UseNamedContextAPI = WithNamedContext "myContext" '[String] (
--       ReqBody '[JSON] Int :> Get '[JSON] Int)
--   
--   
--   Both the ReqBody and Get combinators will use the
--   WithNamedContext with type tag "myContext" as their context.
--   
--   Contexts are only relevant for servant-server.
--   
--   For more information, see the tutorial.
data WithNamedContext (name :: Symbol) (subContext :: [*]) subApi

module Servant.Types.SourceT

-- | This is CPSised ListT.
newtype SourceT m a
SourceT :: (forall b. (StepT m a -> m b) -> m b) -> SourceT m a
[unSourceT] :: SourceT m a -> forall b. (StepT m a -> m b) -> m b
mapStepT :: (StepT m a -> StepT m b) -> SourceT m a -> SourceT m b

-- | ListT with additional constructors.
data StepT m a
Stop :: StepT m a
Error :: String -> StepT m a
Skip :: StepT m a -> StepT m a
Yield :: a -> StepT m a -> StepT m a
Effect :: m (StepT m a) -> StepT m a

-- | Create SourceT from Step.
--   
--   Note: often enough you want to use SourceT directly.
fromStepT :: StepT m a -> SourceT m a

-- | Create pure SourceT.
--   
--   
--   >>> source "foo" :: SourceT Identity Char
--   fromStepT (Effect (Identity (Yield 'f' (Yield 'o' (Yield 'o' Stop)))))
--   
source :: [a] -> SourceT m a

-- | Get the answers.
--   
--   
--   >>> runSourceT (source "foo" :: SourceT Identity Char)
--   ExceptT (Identity (Right "foo"))
--   
--   
--   
--   >>> runSourceT (source "foo" :: SourceT [] Char)
--   ExceptT [Right "foo"]
--   
runSourceT :: Monad m => SourceT m a -> ExceptT String m [a]
runStepT :: Monad m => StepT m a -> ExceptT String m [a]

-- | Filter values.
--   
--   
--   >>> toList $ mapMaybe (\x -> if odd x then Just x else Nothing) (source [0..10]) :: [Int]
--   [1,3,5,7,9]
--   
--   
--   
--   >>> mapMaybe (\x -> if odd x then Just x else Nothing) (source [0..2]) :: SourceT Identity Int
--   fromStepT (Effect (Identity (Skip (Yield 1 (Skip Stop)))))
--   
--   
--   Illustrates why we need Skip.
mapMaybe :: Functor m => (a -> Maybe b) -> SourceT m a -> SourceT m b
mapMaybeStep :: Functor m => (a -> Maybe b) -> StepT m a -> StepT m b

-- | Run action for each value in the SourceT.
--   
--   
--   >>> foreach fail print (source "abc")
--   'a'
--   'b'
--   'c'
--   
foreach :: Monad m => (String -> m ()) -> (a -> m ()) -> SourceT m a -> m ()

-- | See foreach.
foreachStep :: Monad m => (String -> m ()) -> (a -> m ()) -> StepT m a -> m ()
fromAction :: Functor m => (a -> Bool) -> m a -> SourceT m a
fromActionStep :: Functor m => (a -> Bool) -> m a -> StepT m a

-- | Read file.
--   
--   
--   >>> foreach fail BS.putStr (readFile "servant.cabal")
--   cabal-version:       >=1.10
--   name:                servant
--   ...
--   
readFile :: FilePath -> SourceT IO ByteString

-- | Transform using attoparsec parser.
--   
--   Note: parser should not accept empty input!
--   
--   
--   >>> let parser = A.skipWhile A8.isSpace_w8 >> A.takeWhile1 A8.isDigit_w8
--   
--   
--   
--   >>> runExcept $ runSourceT $ transformWithAtto parser (source ["1 2 3"])
--   Right ["1","2","3"]
--   
--   
--   
--   >>> runExcept $ runSourceT $ transformWithAtto parser (source ["1", "2", "3"])
--   Right ["123"]
--   
--   
--   
--   >>> runExcept $ runSourceT $ transformWithAtto parser (source ["1", "2 3", "4"])
--   Right ["12","34"]
--   
--   
--   
--   >>> runExcept $ runSourceT $ transformWithAtto parser (source ["foobar"])
--   Left "Failed reading: takeWhile1"
--   
transformWithAtto :: Monad m => Parser a -> SourceT m ByteString -> SourceT m a
transformStepWithAtto :: forall a m. Monad m => Parser a -> StepT m ByteString -> StepT m a
instance GHC.Base.Functor m => GHC.Base.Functor (Servant.Types.SourceT.StepT m)
instance GHC.Base.Functor m => GHC.Base.Functor (Servant.Types.SourceT.SourceT m)
instance (Data.Functor.Identity.Identity Data.Type.Equality.~ m) => Data.Foldable.Foldable (Servant.Types.SourceT.SourceT m)
instance (GHC.Base.Applicative m, Data.Functor.Classes.Show1 m) => Data.Functor.Classes.Show1 (Servant.Types.SourceT.SourceT m)
instance (GHC.Base.Applicative m, Data.Functor.Classes.Show1 m, GHC.Show.Show a) => GHC.Show.Show (Servant.Types.SourceT.SourceT m a)
instance Control.Monad.Morph.MFunctor Servant.Types.SourceT.SourceT
instance (Test.QuickCheck.Arbitrary.Arbitrary a, GHC.Base.Monad m) => Test.QuickCheck.Arbitrary.Arbitrary (Servant.Types.SourceT.SourceT m a)
instance (Data.Functor.Identity.Identity Data.Type.Equality.~ m) => Data.Foldable.Foldable (Servant.Types.SourceT.StepT m)
instance (GHC.Base.Applicative m, Data.Functor.Classes.Show1 m) => Data.Functor.Classes.Show1 (Servant.Types.SourceT.StepT m)
instance (GHC.Base.Applicative m, Data.Functor.Classes.Show1 m, GHC.Show.Show a) => GHC.Show.Show (Servant.Types.SourceT.StepT m a)
instance Control.Monad.Trans.Class.MonadTrans Servant.Types.SourceT.StepT
instance Control.Monad.Morph.MFunctor Servant.Types.SourceT.StepT
instance (Test.QuickCheck.Arbitrary.Arbitrary a, GHC.Base.Monad m) => Test.QuickCheck.Arbitrary.Arbitrary (Servant.Types.SourceT.StepT m a)

module Servant.API.Stream

-- | A Stream endpoint for a given method emits a stream of encoded values
--   at a given Content-Type, delimited by a framing
--   strategy. Type synonyms are provided for standard methods.
data Stream (method :: k1) (status :: Nat) (framing :: *) (contentType :: *) (a :: *)
type StreamGet = Stream  'GET 200
type StreamPost = Stream  'POST 200

-- | A stream request body.
type StreamBody = StreamBody' '[]
data StreamBody' (mods :: [*]) (framing :: *) (contentType :: *) (a :: *)

-- | Stream endpoints may be implemented as producing a SourceIO
--   chunk.
--   
--   Clients reading from streaming endpoints can be implemented as
--   consuming a SourceIO chunk.
type SourceIO = SourceT IO

-- | ToSourceIO is intended to be implemented for types such as
--   Conduit, Pipe, etc. By implementing this class, all such streaming
--   abstractions can be used directly as endpoints.
class ToSourceIO chunk a | a -> chunk
toSourceIO :: ToSourceIO chunk a => a -> SourceIO chunk

-- | FromSourceIO is intended to be implemented for types such as
--   Conduit, Pipe, etc. By implementing this class, all such streaming
--   abstractions can be used directly on the client side for talking to
--   streaming endpoints.
class FromSourceIO chunk a | a -> chunk
fromSourceIO :: FromSourceIO chunk a => SourceIO chunk -> a

-- | Auxiliary class for ToSourceIO x (SourceT m x)
--   instance.
class SourceToSourceIO m
sourceToSourceIO :: SourceToSourceIO m => SourceT m a -> SourceT IO a

-- | The FramingRender class provides the logic for emitting a
--   framing strategy. The strategy transforms a SourceT m
--   a into SourceT m ByteString, therefore it
--   can prepend, append and intercalate framing structure around
--   chunks.
--   
--   Note: as the Monad m is generic, this is pure
--   transformation.
class FramingRender strategy
framingRender :: (FramingRender strategy, Monad m) => Proxy strategy -> (a -> ByteString) -> SourceT m a -> SourceT m ByteString

-- | The FramingUnrender class provides the logic for parsing a
--   framing strategy.
class FramingUnrender strategy
framingUnrender :: (FramingUnrender strategy, Monad m) => Proxy strategy -> (ByteString -> Either String a) -> SourceT m ByteString -> SourceT m a

-- | A framing strategy that does not do any framing at all, it just passes
--   the input data This will be used most of the time with binary data,
--   such as files
data NoFraming

-- | A simple framing strategy that has no header, and inserts a newline
--   character after each frame. This assumes that it is used with a
--   Content-Type that encodes without newlines (e.g. JSON).
data NewlineFraming

-- | The netstring framing strategy as defined by djb:
--   http://cr.yp.to/proto/netstrings.txt
--   
--   Any string of 8-bit bytes may be encoded as
--   [len]":"[string]",". Here [string] is the string and
--   [len] is a nonempty sequence of ASCII digits giving the
--   length of [string] in decimal. The ASCII digits are
--   30 for 0, 31 for 1, and so on up
--   through 39 for 9. Extra zeros at the front of
--   [len] are prohibited: [len] begins with
--   30 exactly when [string] is empty.
--   
--   For example, the string "hello world!" is encoded as
--   32 3a 68 65 6c 6c 6f 20 77 6f 72 6c 64 21 2c, i.e.,
--   "12:hello world!,". The empty string is encoded as
--   "0:,".
data NetstringFraming
instance GHC.Generics.Generic (Servant.API.Stream.StreamBody' mods framing contentType a)
instance forall k1 (method :: k1) (status :: GHC.Types.Nat) framing contentType a. GHC.Generics.Generic (Servant.API.Stream.Stream method status framing contentType a)
instance Servant.API.Stream.FramingRender Servant.API.Stream.NetstringFraming
instance Servant.API.Stream.FramingUnrender Servant.API.Stream.NetstringFraming
instance Servant.API.Stream.FramingRender Servant.API.Stream.NewlineFraming
instance Servant.API.Stream.FramingUnrender Servant.API.Stream.NewlineFraming
instance Servant.API.Stream.FramingRender Servant.API.Stream.NoFraming
instance Servant.API.Stream.FramingUnrender Servant.API.Stream.NoFraming
instance Control.Monad.IO.Class.MonadIO m => Servant.API.Stream.FromSourceIO a (Servant.Types.SourceT.SourceT m a)
instance Servant.API.Stream.SourceToSourceIO GHC.Types.IO
instance Servant.API.Stream.SourceToSourceIO m => Servant.API.Stream.ToSourceIO chunk (Servant.Types.SourceT.SourceT m chunk)
instance Servant.API.Stream.ToSourceIO a (GHC.Base.NonEmpty a)
instance Servant.API.Stream.ToSourceIO a [a]

-- | Type safe generation of internal links.
--   
--   Given an API with a few endpoints:
--   
--   
--   >>> :set -XDataKinds -XTypeFamilies -XTypeOperators
--   
--   >>> import Servant.API
--   
--   >>> import Servant.Links
--   
--   >>> import Data.Proxy
--   
--   >>> 
--   
--   >>> type Hello = "hello" :> Get '[JSON] Int
--   
--   >>> type Bye   = "bye"   :> QueryParam "name" String :> Delete '[JSON] NoContent
--   
--   >>> type API   = Hello :<|> Bye
--   
--   >>> let api = Proxy :: Proxy API
--   
--   
--   It is possible to generate links that are guaranteed to be within
--   API with safeLink. The first argument to
--   safeLink is a type representing the API you would like to
--   restrict links to. The second argument is the destination endpoint you
--   would like the link to point to, this will need to end with a verb
--   like GET or POST. Further arguments may be required depending on the
--   type of the endpoint. If everything lines up you will get a
--   Link out the other end.
--   
--   You may omit QueryParams and the like should you not want to
--   provide them, but types which form part of the URL path like
--   Capture must be included. The reason you may want to omit
--   QueryParams is that safeLink is a bit magical: if parameters
--   are included that could take input it will return a function that
--   accepts that input and generates a link. This is best shown with an
--   example. Here, a link is generated with no parameters:
--   
--   
--   >>> let hello = Proxy :: Proxy ("hello" :> Get '[JSON] Int)
--   
--   >>> toUrlPiece (safeLink api hello :: Link)
--   "hello"
--   
--   
--   If the API has an endpoint with parameters then we can generate links
--   with or without those:
--   
--   
--   >>> let with = Proxy :: Proxy ("bye" :> QueryParam "name" String :> Delete '[JSON] NoContent)
--   
--   >>> toUrlPiece $ safeLink api with (Just "Hubert")
--   "bye?name=Hubert"
--   
--   
--   
--   >>> let without = Proxy :: Proxy ("bye" :> Delete '[JSON] NoContent)
--   
--   >>> toUrlPiece $ safeLink api without
--   "bye"
--   
--   
--   If you would like create a helper for generating links only within
--   that API, you can partially apply safeLink if you specify a correct
--   type signature like so:
--   
--   
--   >>> :set -XConstraintKinds
--   
--   >>> :{
--   
--   >>> let apiLink :: (IsElem endpoint API, HasLink endpoint)
--   
--   >>> => Proxy endpoint -> MkLink endpoint Link
--   
--   >>> apiLink = safeLink api
--   
--   >>> :}
--   
--   
--   safeLink' allows to make specialise the output:
--   
--   
--   >>> safeLink' toUrlPiece api without
--   "bye"
--   
--   
--   
--   >>> :{
--   
--   >>> let apiTextLink :: (IsElem endpoint API, HasLink endpoint)
--   
--   >>> => Proxy endpoint -> MkLink endpoint Text
--   
--   >>> apiTextLink = safeLink' toUrlPiece api
--   
--   >>> :}
--   
--   
--   
--   >>> apiTextLink without
--   "bye"
--   
--   
--   Attempting to construct a link to an endpoint that does not exist in
--   api will result in a type error like this:
--   
--   
--   >>> let bad_link = Proxy :: Proxy ("hello" :> Delete '[JSON] NoContent)
--   
--   >>> safeLink api bad_link
--   ...
--   ...Could not deduce...
--   ...
--   
--   
--   This error is essentially saying that the type family couldn't find
--   bad_link under api after trying the open (but empty) type family
--   IsElem' as a last resort.
module Servant.Links

-- | Create a valid (by construction) relative URI with query params.
--   
--   This function will only typecheck if endpoint is part of the
--   API api
safeLink :: forall endpoint api. (IsElem endpoint api, HasLink endpoint) => Proxy api -> Proxy endpoint -> MkLink endpoint Link

-- | More general safeLink.
safeLink' :: forall endpoint api a. (IsElem endpoint api, HasLink endpoint) => (Link -> a) -> Proxy api -> Proxy endpoint -> MkLink endpoint a

-- | Create all links in an API.
--   
--   Note that the api type must be restricted to the endpoints
--   that have valid links to them.
--   
--   
--   >>> type API = "foo" :> Capture "name" Text :> Get '[JSON] Text :<|> "bar" :> Capture "name" Int :> Get '[JSON] Double
--   
--   >>> let fooLink :<|> barLink = allLinks (Proxy :: Proxy API)
--   
--   >>> :t fooLink
--   fooLink :: Text -> Link
--   
--   >>> :t barLink
--   barLink :: Int -> Link
--   
--   
--   Note: nested APIs don't work well with this approach
--   
--   
--   >>> :kind! MkLink (Capture "nest" Char :> (Capture "x" Int :> Get '[JSON] Int :<|> Capture "y" Double :> Get '[JSON] Double)) Link
--   MkLink (Capture "nest" Char :> (Capture "x" Int :> Get '[JSON] Int :<|> Capture "y" Double :> Get '[JSON] Double)) Link :: *
--   = Char -> (Int -> Link) :<|> (Double -> Link)
--   
allLinks :: forall api. HasLink api => Proxy api -> MkLink api Link

-- | More general allLinks. See safeLink'.
allLinks' :: forall api a. HasLink api => (Link -> a) -> Proxy api -> MkLink api a

-- | Represents a general universal resource identifier using its component
--   parts.
--   
--   For example, for the URI
--   
--   
--   foo://anonymous@www.haskell.org:42/ghc?query#frag
--   
--   
--   the components are:
data URI
URI :: String -> Maybe URIAuth -> String -> String -> String -> URI

-- | 
--   foo:
--   
[uriScheme] :: URI -> String

-- | 
--   //anonymous@www.haskell.org:42
--   
[uriAuthority] :: URI -> Maybe URIAuth

-- | 
--   /ghc
--   
[uriPath] :: URI -> String

-- | 
--   ?query
--   
[uriQuery] :: URI -> String

-- | 
--   #frag
--   
[uriFragment] :: URI -> String

-- | A type that specifies that an API record contains a set of links.
data AsLink (a :: *)

-- | Given an API record field, create a link for that route. Only the
--   field's type is used.
--   
--   
--   data Record route = Record
--       { _get :: route :- Capture "id" Int :> Get '[JSON] String
--       , _put :: route :- ReqBody '[JSON] Int :> Put '[JSON] Bool
--       }
--     deriving (Generic)
--   
--   getLink :: Int -> Link
--   getLink = fieldLink _get
--   
fieldLink :: (IsElem endpoint (ToServantApi routes), HasLink endpoint, GenericServant routes AsApi) => (routes AsApi -> endpoint) -> MkLink endpoint Link

-- | More general version of fieldLink
fieldLink' :: forall routes endpoint a. (IsElem endpoint (ToServantApi routes), HasLink endpoint, GenericServant routes AsApi) => (Link -> a) -> (routes AsApi -> endpoint) -> MkLink endpoint a

-- | Get all links as a record.
allFieldLinks :: (HasLink (ToServantApi routes), GenericServant routes (AsLink Link), ToServant routes (AsLink Link) ~ MkLink (ToServantApi routes) Link) => routes (AsLink Link)

-- | More general version of allFieldLinks.
allFieldLinks' :: forall routes a. (HasLink (ToServantApi routes), GenericServant routes (AsLink a), ToServant routes (AsLink a) ~ MkLink (ToServantApi routes) a) => (Link -> a) -> routes (AsLink a)

-- | Construct a toLink for an endpoint.
class HasLink endpoint where {
    type family MkLink endpoint (a :: *);
}
toLink :: HasLink endpoint => (Link -> a) -> Proxy endpoint -> Link -> MkLink endpoint a

-- | A safe link datatype. The only way of constructing a Link is
--   using safeLink, which means any Link is guaranteed to be
--   part of the mentioned API.
data Link

-- | Transform Link into URI.
--   
--   
--   >>> type API = "something" :> Get '[JSON] Int
--   
--   >>> linkURI $ safeLink (Proxy :: Proxy API) (Proxy :: Proxy API)
--   something
--   
--   
--   
--   >>> type API = "sum" :> QueryParams "x" Int :> Get '[JSON] Int
--   
--   >>> linkURI $ safeLink (Proxy :: Proxy API) (Proxy :: Proxy API) [1, 2, 3]
--   sum?x[]=1&x[]=2&x[]=3
--   
--   
--   
--   >>> type API = "foo/bar" :> Get '[JSON] Int
--   
--   >>> linkURI $ safeLink (Proxy :: Proxy API) (Proxy :: Proxy API)
--   foo%2Fbar
--   
--   
--   
--   >>> type SomeRoute = "abc" :> Capture "email" String :> Put '[JSON] ()
--   
--   >>> let someRoute = Proxy :: Proxy SomeRoute
--   
--   >>> safeLink someRoute someRoute "test@example.com"
--   Link {_segments = ["abc","test%40example.com"], _queryParams = []}
--   
--   
--   
--   >>> linkURI $ safeLink someRoute someRoute "test@example.com"
--   abc/test%40example.com
--   
linkURI :: Link -> URI

-- | Configurable linkURI.
--   
--   
--   >>> type API = "sum" :> QueryParams "x" Int :> Get '[JSON] Int
--   
--   >>> linkURI' LinkArrayElementBracket $ safeLink (Proxy :: Proxy API) (Proxy :: Proxy API) [1, 2, 3]
--   sum?x[]=1&x[]=2&x[]=3
--   
--   
--   
--   >>> linkURI' LinkArrayElementPlain $ safeLink (Proxy :: Proxy API) (Proxy :: Proxy API) [1, 2, 3]
--   sum?x=1&x=2&x=3
--   
linkURI' :: LinkArrayElementStyle -> Link -> URI

-- | How to encode array query elements.
data LinkArrayElementStyle

-- | 
--   foo[]=1&foo[]=2
--   
LinkArrayElementBracket :: LinkArrayElementStyle

-- | 
--   foo=1&foo=2
--   
LinkArrayElementPlain :: LinkArrayElementStyle

-- | Query parameter.
data Param
SingleParam :: String -> Text -> Param
ArrayElemParam :: String -> Text -> Param
FlagParam :: String -> Param
linkSegments :: Link -> [String]
linkQueryParams :: Link -> [Param]
instance GHC.Enum.Bounded Servant.Links.LinkArrayElementStyle
instance GHC.Enum.Enum Servant.Links.LinkArrayElementStyle
instance GHC.Show.Show Servant.Links.LinkArrayElementStyle
instance GHC.Classes.Ord Servant.Links.LinkArrayElementStyle
instance GHC.Classes.Eq Servant.Links.LinkArrayElementStyle
instance GHC.Show.Show Servant.Links.Link
instance GHC.Show.Show Servant.Links.Param
instance Servant.API.Generic.GenericMode (Servant.Links.AsLink a)
instance (GHC.TypeLits.KnownSymbol sym, Servant.Links.HasLink sub) => Servant.Links.HasLink (sym Servant.API.Sub.:> sub)
instance (GHC.TypeLits.KnownSymbol sym, Web.Internal.HttpApiData.ToHttpApiData v, Servant.Links.HasLink sub, Data.Singletons.Bool.SBoolI (Servant.API.Modifiers.FoldRequired mods)) => Servant.Links.HasLink (Servant.API.QueryParam.QueryParam' mods sym v Servant.API.Sub.:> sub)
instance (GHC.TypeLits.KnownSymbol sym, Web.Internal.HttpApiData.ToHttpApiData v, Servant.Links.HasLink sub) => Servant.Links.HasLink (Servant.API.QueryParam.QueryParams sym v Servant.API.Sub.:> sub)
instance (GHC.TypeLits.KnownSymbol sym, Servant.Links.HasLink sub) => Servant.Links.HasLink (Servant.API.QueryParam.QueryFlag sym Servant.API.Sub.:> sub)
instance (Servant.Links.HasLink a, Servant.Links.HasLink b) => Servant.Links.HasLink (a Servant.API.Alternative.:<|> b)
instance Servant.Links.HasLink sub => Servant.Links.HasLink (Servant.API.ReqBody.ReqBody' mods ct a Servant.API.Sub.:> sub)
instance Servant.Links.HasLink sub => Servant.Links.HasLink (Servant.API.Stream.StreamBody' mods framing ct a Servant.API.Sub.:> sub)
instance (Web.Internal.HttpApiData.ToHttpApiData v, Servant.Links.HasLink sub) => Servant.Links.HasLink (Servant.API.Capture.Capture' mods sym v Servant.API.Sub.:> sub)
instance (Web.Internal.HttpApiData.ToHttpApiData v, Servant.Links.HasLink sub) => Servant.Links.HasLink (Servant.API.Capture.CaptureAll sym v Servant.API.Sub.:> sub)
instance Servant.Links.HasLink sub => Servant.Links.HasLink (Servant.API.Header.Header' mods sym a Servant.API.Sub.:> sub)
instance Servant.Links.HasLink sub => Servant.Links.HasLink (Data.Vault.Lazy.Vault Servant.API.Sub.:> sub)
instance Servant.Links.HasLink sub => Servant.Links.HasLink (Servant.API.Description.Description s Servant.API.Sub.:> sub)
instance Servant.Links.HasLink sub => Servant.Links.HasLink (Servant.API.Description.Summary s Servant.API.Sub.:> sub)
instance Servant.Links.HasLink sub => Servant.Links.HasLink (Network.HTTP.Types.Version.HttpVersion Servant.API.Sub.:> sub)
instance Servant.Links.HasLink sub => Servant.Links.HasLink (Servant.API.IsSecure.IsSecure Servant.API.Sub.:> sub)
instance Servant.Links.HasLink sub => Servant.Links.HasLink (Servant.API.WithNamedContext.WithNamedContext name context sub)
instance Servant.Links.HasLink sub => Servant.Links.HasLink (Servant.API.RemoteHost.RemoteHost Servant.API.Sub.:> sub)
instance Servant.Links.HasLink sub => Servant.Links.HasLink (Servant.API.BasicAuth.BasicAuth realm a Servant.API.Sub.:> sub)
instance Servant.Links.HasLink Servant.API.Empty.EmptyAPI
instance forall k1 (m :: k1) (s :: GHC.Types.Nat) (ct :: [*]) a. Servant.Links.HasLink (Servant.API.Verbs.Verb m s ct a)
instance Servant.Links.HasLink Servant.API.Raw.Raw
instance forall k1 (m :: k1) (status :: GHC.Types.Nat) fr ct a. Servant.Links.HasLink (Servant.API.Stream.Stream m status fr ct a)
instance forall k sub (tag :: k). Servant.Links.HasLink sub => Servant.Links.HasLink (Servant.API.Experimental.Auth.AuthProtect tag Servant.API.Sub.:> sub)
instance Web.Internal.HttpApiData.ToHttpApiData Servant.Links.Link
instance GHC.Show.Show Servant.Links.Escaped

module Servant.API

-- | The contained API (second argument) can be found under ("/" ++
--   path) (path being the first argument).
--   
--   Example:
--   
--   
--   >>> -- GET /hello/world
--   
--   >>> -- returning a JSON encoded World value
--   
--   >>> type MyApi = "hello" :> "world" :> Get '[JSON] World
--   
data (path :: k) :> (a :: *)
infixr 4 :>

-- | Union of two APIs, first takes precedence in case of overlap.
--   
--   Example:
--   
--   
--   >>> :{
--   type MyApi = "books" :> Get '[JSON] [Book] -- GET /books
--          :<|> "books" :> ReqBody '[JSON] Book :> Post '[JSON] () -- POST /books
--   :}
--   
data a :<|> b
(:<|>) :: a -> b -> (:<|>) a b
infixr 3 :<|>
infixr 3 :<|>

-- | An empty API: one which serves nothing. Morally speaking, this should
--   be the unit of :<|>. Implementors of interpretations of
--   API types should treat EmptyAPI as close to the unit as
--   possible.
data EmptyAPI
EmptyAPI :: EmptyAPI

-- | Strictly parsed argument. Not wrapped.
data Strict

-- | Leniently parsed argument, i.e. parsing never fail. Wrapped in
--   Either Text.
data Lenient

-- | Optional argument. Wrapped in Maybe.
data Optional

-- | Required argument. Not wrapped.
data Required

-- | Capture all remaining values from the request path under a certain
--   type a.
--   
--   Example:
--   
--   
--   >>> -- GET /src/*
--   
--   >>> type MyAPI = "src" :> CaptureAll "segments" Text :> Get '[JSON] SourceFile
--   
data CaptureAll (sym :: Symbol) (a :: *)

-- | Capture which can be modified. For example with
--   Description.
data Capture' (mods :: [*]) (sym :: Symbol) (a :: *)

-- | Capture a value from the request path under a certain type a.
--   
--   Example:
--   
--   
--   >>> -- GET /books/:isbn
--   
--   >>> type MyApi = "books" :> Capture "isbn" Text :> Get '[JSON] Book
--   
type Capture = Capture' '[]
data Header' (mods :: [*]) (sym :: Symbol) a

-- | Extract the given header's value as a value of type a. I.e.
--   header sent by client, parsed by server.
--   
--   Example:
--   
--   
--   >>> newtype Referer = Referer Text deriving (Eq, Show)
--   
--   >>> 
--   
--   >>> -- GET /view-my-referer
--   
--   >>> type MyApi = "view-my-referer" :> Header "from" Referer :> Get '[JSON] Referer
--   
type Header = Header' '[Optional, Strict]

-- | HTTP Version.
--   
--   Note that the Show instance is intended merely for debugging.
data HttpVersion
HttpVersion :: !Int -> !Int -> HttpVersion
[httpMajor] :: HttpVersion -> !Int
[httpMinor] :: HttpVersion -> !Int

-- | 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 True.
--   Otherwise, it's interpreted as False.
--   
--   Example:
--   
--   
--   >>> -- /books?published
--   
--   >>> type MyApi = "books" :> QueryFlag "published" :> Get '[JSON] [Book]
--   
data QueryFlag (sym :: Symbol)

-- | Lookup the values associated to the sym query string
--   parameter and try to extract it as a value of type [a]. 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:
--   
--   
--   >>> -- /books?authors[]=<author1>&authors[]=<author2>&...
--   
--   >>> type MyApi = "books" :> QueryParams "authors" Text :> Get '[JSON] [Book]
--   
data QueryParams (sym :: Symbol) (a :: *)

-- | QueryParam which can be Required, Lenient, or
--   modified otherwise.
data QueryParam' (mods :: [*]) (sym :: Symbol) (a :: *)

-- | Lookup the value associated to the sym query string parameter
--   and try to extract it as a value of type a.
--   
--   Example:
--   
--   
--   >>> -- /books?author=<author name>
--   
--   >>> type MyApi = "books" :> QueryParam "author" Text :> Get '[JSON] [Book]
--   
type QueryParam = QueryParam' '[Optional, Strict]

-- | Note: ReqBody' is always Required.
data ReqBody' (mods :: [*]) (contentTypes :: [*]) (a :: *)

-- | Extract the request body as a value of type a.
--   
--   Example:
--   
--   
--   >>> -- POST /books
--   
--   >>> type MyApi = "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book
--   
type ReqBody = ReqBody' '[Required, Strict]

-- | Provides access to the host or IP address from which the HTTP request
--   was sent.
data RemoteHost

-- | Was this request made over an SSL connection?
--   
--   Note 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
--   NotSecure, but from a user perspective, there is a secure
--   connection.
data IsSecure

-- | the connection to the server is secure (HTTPS)
Secure :: IsSecure

-- | the connection to the server is not secure (HTTP)
NotSecure :: IsSecure

-- | A persistent store for values of arbitrary types.
--   
--   This variant is the simplest and creates keys in the IO monad.
--   See the module Data.Vault.ST if you want to use it with the
--   ST monad instead.
type Vault = Vault RealWorld

-- | WithNamedContext names a specific tagged context to use for the
--   combinators in the API. (See also in servant-server,
--   Servant.Server.Context.) For example:
--   
--   
--   type UseNamedContextAPI = WithNamedContext "myContext" '[String] (
--       ReqBody '[JSON] Int :> Get '[JSON] Int)
--   
--   
--   Both the ReqBody and Get combinators will use the
--   WithNamedContext with type tag "myContext" as their context.
--   
--   Contexts are only relevant for servant-server.
--   
--   For more information, see the tutorial.
data WithNamedContext (name :: Symbol) (subContext :: [*]) subApi

-- | HTTP standard method (as defined by RFC 2616, and PATCH which is
--   defined by RFC 5789).
data StdMethod
GET :: StdMethod
POST :: StdMethod
HEAD :: StdMethod
PUT :: StdMethod
DELETE :: StdMethod
TRACE :: StdMethod
CONNECT :: StdMethod
OPTIONS :: StdMethod
PATCH :: StdMethod
class ReflectMethod a
reflectMethod :: ReflectMethod a => Proxy a -> Method

-- | GET with 206 status code.
type GetPartialContent = Verb  'GET 206

-- | POST with 205 status code.
type PostResetContent = Verb  'POST 205

-- | GET with 205 status code.
type GetResetContent = Verb  'GET 205

-- | PUT with 204 status code.
type PutNoContent = Verb  'PUT 204

-- | PATCH with 204 status code.
type PatchNoContent = Verb  'PATCH 204

-- | DELETE with 204 status code.
type DeleteNoContent = Verb  'DELETE 204

-- | POST with 204 status code.
type PostNoContent = Verb  'POST 204

-- | GET with 204 status code.
type GetNoContent = Verb  'GET 204

-- | PUT with 203 status code.
type PutNonAuthoritative = Verb  'PUT 203

-- | PATCH with 203 status code.
type PatchNonAuthoritative = Verb  'PATCH 203

-- | DELETE with 203 status code.
type DeleteNonAuthoritative = Verb  'DELETE 203

-- | POST with 203 status code.
type PostNonAuthoritative = Verb  'POST 203

-- | GET with 203 status code.
type GetNonAuthoritative = Verb  'GET 203

-- | PUT with 202 status code.
type PutAccepted = Verb  'PUT 202

-- | PATCH with 202 status code.
type PatchAccepted = Verb  'PATCH 202

-- | DELETE with 202 status code.
type DeleteAccepted = Verb  'DELETE 202

-- | POST with 202 status code.
type PostAccepted = Verb  'POST 202

-- | GET with 202 status code.
type GetAccepted = Verb  'GET 202

-- | PUT with 201 status code.
type PutCreated = Verb  'PUT 201

-- | POST with 201 status code.
type PostCreated = Verb  'POST 201

-- | PATCH with 200 status code.
type Patch = Verb  'PATCH 200

-- | DELETE with 200 status code.
type Delete = Verb  'DELETE 200

-- | PUT with 200 status code.
type Put = Verb  'PUT 200

-- | POST with 200 status code.
type Post = Verb  'POST 200

-- | GET with 200 status code.
type Get = Verb  'GET 200

-- | Verb 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
--   
data Verb (method :: k1) (statusCode :: Nat) (contentTypes :: [*]) (a :: *)

-- | The netstring framing strategy as defined by djb:
--   http://cr.yp.to/proto/netstrings.txt
--   
--   Any string of 8-bit bytes may be encoded as
--   [len]":"[string]",". Here [string] is the string and
--   [len] is a nonempty sequence of ASCII digits giving the
--   length of [string] in decimal. The ASCII digits are
--   30 for 0, 31 for 1, and so on up
--   through 39 for 9. Extra zeros at the front of
--   [len] are prohibited: [len] begins with
--   30 exactly when [string] is empty.
--   
--   For example, the string "hello world!" is encoded as
--   32 3a 68 65 6c 6c 6f 20 77 6f 72 6c 64 21 2c, i.e.,
--   "12:hello world!,". The empty string is encoded as
--   "0:,".
data NetstringFraming

-- | A simple framing strategy that has no header, and inserts a newline
--   character after each frame. This assumes that it is used with a
--   Content-Type that encodes without newlines (e.g. JSON).
data NewlineFraming

-- | A framing strategy that does not do any framing at all, it just passes
--   the input data This will be used most of the time with binary data,
--   such as files
data NoFraming

-- | The FramingUnrender class provides the logic for parsing a
--   framing strategy.
class FramingUnrender strategy
framingUnrender :: (FramingUnrender strategy, Monad m) => Proxy strategy -> (ByteString -> Either String a) -> SourceT m ByteString -> SourceT m a

-- | The FramingRender class provides the logic for emitting a
--   framing strategy. The strategy transforms a SourceT m
--   a into SourceT m ByteString, therefore it
--   can prepend, append and intercalate framing structure around
--   chunks.
--   
--   Note: as the Monad m is generic, this is pure
--   transformation.
class FramingRender strategy
framingRender :: (FramingRender strategy, Monad m) => Proxy strategy -> (a -> ByteString) -> SourceT m a -> SourceT m ByteString

-- | FromSourceIO is intended to be implemented for types such as
--   Conduit, Pipe, etc. By implementing this class, all such streaming
--   abstractions can be used directly on the client side for talking to
--   streaming endpoints.
class FromSourceIO chunk a | a -> chunk
fromSourceIO :: FromSourceIO chunk a => SourceIO chunk -> a

-- | ToSourceIO is intended to be implemented for types such as
--   Conduit, Pipe, etc. By implementing this class, all such streaming
--   abstractions can be used directly as endpoints.
class ToSourceIO chunk a | a -> chunk
toSourceIO :: ToSourceIO chunk a => a -> SourceIO chunk

-- | Stream endpoints may be implemented as producing a SourceIO
--   chunk.
--   
--   Clients reading from streaming endpoints can be implemented as
--   consuming a SourceIO chunk.
type SourceIO = SourceT IO
data StreamBody' (mods :: [*]) (framing :: *) (contentType :: *) (a :: *)

-- | A stream request body.
type StreamBody = StreamBody' '[]
type StreamPost = Stream  'POST 200
type StreamGet = Stream  'GET 200

-- | A Stream endpoint for a given method emits a stream of encoded values
--   at a given Content-Type, delimited by a framing
--   strategy. Type synonyms are provided for standard methods.
data Stream (method :: k1) (status :: Nat) (framing :: *) (contentType :: *) (a :: *)

-- | A simple datatype to hold data required to decorate a request
data BasicAuthData
BasicAuthData :: !ByteString -> !ByteString -> BasicAuthData
[basicAuthUsername] :: BasicAuthData -> !ByteString
[basicAuthPassword] :: BasicAuthData -> !ByteString

-- | Combinator for Basic Access Authentication.
--   
--   
--   
- IMPORTANT*: 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.
--   
--   
--   In Basic Auth, username and password are base64-encoded and
--   transmitted via the Authorization header. Handshakes are not
--   required, making it relatively efficient.
data BasicAuth (realm :: Symbol) (userData :: *)

-- | Add more verbose description for (part of) API.
--   
--   Example:
--   
--   
--   >>> :{
--   type MyApi = Description
--    "This comment is visible in multiple Servant interpretations \
--    \and can be really long if necessary. \
--    \Haskell multiline support is not perfect \
--    \but it's still very readable."
--   :> Get '[JSON] Book
--   :}
--   
data Description (sym :: Symbol)

-- | Add a short summary for (part of) API.
--   
--   Example:
--   
--   
--   >>> type MyApi = Summary "Get book by ISBN." :> "books" :> Capture "isbn" Text :> Get '[JSON] Book
--   
data Summary (sym :: Symbol)

-- | A type for responses without content-body.
data NoContent
NoContent :: NoContent

-- | Instantiate this class to register a way of deserializing a type based
--   on the request's Content-Type header.
--   
--   
--   >>> import Network.HTTP.Media hiding (Accept)
--   
--   >>> import qualified Data.ByteString.Lazy.Char8 as BSC
--   
--   >>> data MyContentType = MyContentType String
--   
--   
--   
--   >>> :{
--   instance Accept MyContentType where
--      contentType _ = "example" // "prs.me.mine" /: ("charset", "utf-8")
--   :}
--   
--   
--   
--   >>> :{
--   instance Read a => MimeUnrender MyContentType a where
--      mimeUnrender _ bs = case BSC.take 12 bs of
--        "MyContentType" -> return . read . BSC.unpack $ BSC.drop 12 bs
--        _ -> Left "didn't start with the magic incantation"
--   :}
--   
--   
--   
--   >>> type MyAPI = "path" :> ReqBody '[MyContentType] Int :> Get '[JSON] Int
--   
class Accept ctype => MimeUnrender ctype a
mimeUnrender :: MimeUnrender ctype a => Proxy ctype -> ByteString -> Either String a

-- | Variant which is given the actual MediaType provided by the
--   other party.
--   
--   In the most cases you don't want to branch based on the
--   MediaType. See pr552 for a motivating example.
mimeUnrenderWithType :: MimeUnrender ctype a => Proxy ctype -> MediaType -> ByteString -> Either String a

-- | Instantiate 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
--   
class Accept ctype => MimeRender ctype a
mimeRender :: MimeRender ctype a => Proxy ctype -> a -> ByteString

-- | Instances of Accept represent mimetypes. They are used for
--   matching against the Accept HTTP header of the request, and
--   for setting the Content-Type header of the response
--   
--   Example:
--   
--   
--   >>> import Network.HTTP.Media ((//), (/:))
--   
--   >>> data HTML
--   
--   >>> :{
--   instance Accept HTML where
--      contentType _ = "text" // "html" /: ("charset", "utf-8")
--   :}
--   
class Accept ctype
contentType :: Accept ctype => Proxy ctype -> MediaType
contentTypes :: Accept ctype => Proxy ctype -> NonEmpty MediaType
data OctetStream
data FormUrlEncoded
data PlainText
data JSON
class HasResponseHeader h a headers
class AddHeader h v orig new | h v orig -> new, new -> h, new -> v, new -> orig
class GetHeaders ls
getHeaders :: GetHeaders ls => ls -> [Header]
class BuildHeadersTo hs

-- | Note: if there are multiple occurences of a header in the argument,
--   the values are interspersed with commas before deserialization (see
--   RFC2616 Sec 4.2)
buildHeadersTo :: BuildHeadersTo hs => [Header] -> HList hs
data HList a
[HNil] :: HList '[]
[HCons] :: ResponseHeader h x -> HList xs -> HList (Header h x : xs)
data ResponseHeader (sym :: Symbol) a
Header :: a -> ResponseHeader a
MissingHeader :: ResponseHeader a
UndecodableHeader :: ByteString -> ResponseHeader a

-- | Response Header objects. You should never need to construct one
--   directly. Instead, use addOptionalHeader.
data Headers ls a
Headers :: a -> HList ls -> Headers ls a

-- | The underlying value of a Headers
[getResponse] :: Headers ls a -> a

-- | HList of headers.
[getHeadersHList] :: Headers ls a -> HList ls

-- | 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]":
--   
--   
--   
--   >>> let example1 = addHeader 5 "hi" :: Headers '[Header "someheader" Int] String;
--   
--   >>> getHeaders example1
--   [("someheader","5")]
--   
--   
--   
--   
- A value that already has a header has its new header *prepended*
--   to the existing list:
--   
--   
--   
--   >>> let example1 = addHeader 5 "hi" :: Headers '[Header "someheader" Int] String;
--   
--   >>> let example2 = addHeader True example1 :: Headers '[Header "1st" Bool, Header "someheader" Int] String
--   
--   >>> getHeaders 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.
addHeader :: AddHeader h v orig new => v -> orig -> new

-- | Deliberately do not add a header to a value.
--   
--   
--   >>> let example1 = noHeader "hi" :: Headers '[Header "someheader" Int] String
--   
--   >>> getHeaders example1
--   []
--   
noHeader :: AddHeader h v orig new => orig -> new

-- | Look up a specific ResponseHeader, without having to know what
--   position it is in the HList.
--   
--   
--   >>> let example1 = addHeader 5 "hi" :: Headers '[Header "someheader" Int] String
--   
--   >>> let example2 = addHeader True example1 :: Headers '[Header "1st" Bool, Header "someheader" Int] String
--   
--   >>> lookupResponseHeader example2 :: ResponseHeader "someheader" Int
--   Header 5
--   
--   
--   
--   >>> lookupResponseHeader example2 :: ResponseHeader "1st" Bool
--   Header True
--   
--   
--   Usage of this function relies on an explicit type annotation of the
--   header to be looked up. This can be done with type annotations on the
--   result, or with an explicit type application. In this example, the
--   type of header value is determined by the type-inference, we only
--   specify the name of the header:
--   
--   
--   >>> :set -XTypeApplications
--   
--   >>> case lookupResponseHeader @"1st" example2 of { Header b -> b ; _ -> False }
--   True
--   
lookupResponseHeader :: HasResponseHeader h a headers => Headers headers r -> ResponseHeader h a

-- | Endpoint for plugging in your own Wai Applications.
--   
--   The given Application 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
--   serveDirectory to serve static files stored in a particular
--   directory on your filesystem
data Raw

-- | Convert value to HTTP API data.
--   
--   WARNING: Do not derive this using DeriveAnyClass as
--   the generated instance will loop indefinitely.
class ToHttpApiData a

-- | Convert to URL path piece.
toUrlPiece :: ToHttpApiData a => a -> Text

-- | Convert to a URL path piece, making sure to encode any special chars.
--   The default definition uses encodePathSegmentsRelative, but
--   this may be overriden with a more efficient version.
toEncodedUrlPiece :: ToHttpApiData a => a -> Builder

-- | Convert to HTTP header value.
toHeader :: ToHttpApiData a => a -> ByteString

-- | Convert to query param value.
toQueryParam :: ToHttpApiData a => a -> Text

-- | Parse value from HTTP API data.
--   
--   WARNING: Do not derive this using DeriveAnyClass as
--   the generated instance will loop indefinitely.
class FromHttpApiData a

-- | Parse URL path piece.
parseUrlPiece :: FromHttpApiData a => Text -> Either Text a

-- | Parse HTTP header value.
parseHeader :: FromHttpApiData a => ByteString -> Either Text a

-- | Parse query param value.
parseQueryParam :: FromHttpApiData a => Text -> Either Text a

-- | A generalized Authentication combinator. Use this if you have a
--   non-standard authentication technique.
--   
--   NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE.
data AuthProtect (tag :: k)

-- | Represents a general universal resource identifier using its component
--   parts.
--   
--   For example, for the URI
--   
--   
--   foo://anonymous@www.haskell.org:42/ghc?query#frag
--   
--   
--   the components are:
data URI
URI :: String -> Maybe URIAuth -> String -> String -> String -> URI

-- | 
--   foo:
--   
[uriScheme] :: URI -> String

-- | 
--   //anonymous@www.haskell.org:42
--   
[uriAuthority] :: URI -> Maybe URIAuth

-- | 
--   /ghc
--   
[uriPath] :: URI -> String

-- | 
--   ?query
--   
[uriQuery] :: URI -> String

-- | 
--   #frag
--   
[uriFragment] :: URI -> String

-- | Closed type family, check if endpoint is within api.
--   Uses IsElem' if it exhausts all other options.
--   
--   
--   >>> ok (Proxy :: Proxy (IsElem ("hello" :> Get '[JSON] Int) SampleAPI))
--   OK
--   
--   
--   
--   >>> ok (Proxy :: Proxy (IsElem ("bye" :> Get '[JSON] Int) SampleAPI))
--   ...
--   ... Could not deduce...
--   ...
--   
--   
--   An endpoint is considered within an api even if it is missing
--   combinators that don't affect the URL:
--   
--   
--   >>> ok (Proxy :: Proxy (IsElem (Get '[JSON] Int) (Header "h" Bool :> Get '[JSON] Int)))
--   OK
--   
--   
--   
--   >>> ok (Proxy :: Proxy (IsElem (Get '[JSON] Int) (ReqBody '[JSON] Bool :> Get '[JSON] Int)))
--   OK
--   
--   
--   
--   
- N.B.:* IsElem a b 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 IsIn).
--   
type family IsElem endpoint api :: Constraint

-- | 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
--   QueryParam that are optional in a URI and do not
--   affect them if they are omitted.
--   
--   
--   >>> data CustomThing
--   
--   >>> type instance IsElem' e (CustomThing :> s) = IsElem e s
--   
--   
--   Note that IsElem is called, which will mutually
--   recurse back to IsElem' if it exhausts all other
--   options again.
--   
--   Once you have written a HasLink instance for
--   CustomThing you are ready to go.
type family IsElem' a s :: Constraint

-- | Construct a toLink for an endpoint.
class HasLink endpoint where {
    type family MkLink endpoint (a :: *);
}
toLink :: HasLink endpoint => (Link -> a) -> Proxy endpoint -> Link -> MkLink endpoint a

-- | A safe link datatype. The only way of constructing a Link is
--   using safeLink, which means any Link is guaranteed to be
--   part of the mentioned API.
data Link

-- | Create a valid (by construction) relative URI with query params.
--   
--   This function will only typecheck if endpoint is part of the
--   API api
safeLink :: forall endpoint api. (IsElem endpoint api, HasLink endpoint) => Proxy api -> Proxy endpoint -> MkLink endpoint Link

-- | Type-level If. If True a b ==> a; If
--   False a b ==> b
type family If (cond :: Bool) (tru :: k) (fls :: k) :: k
data SBool (b :: Bool)
[STrue] :: forall (b :: Bool). () => SBool True
[SFalse] :: forall (b :: Bool). () => SBool False
class SBoolI (b :: Bool)
sbool :: SBoolI b => SBool b

-- | This is a module containing an API with all API combinators. It
--   is used for testing only (in particular, checking that instances exist
--   for the core servant classes for each combinator).
module Servant.Test.ComprehensiveAPI
type GET = Get '[JSON] NoContent
type ComprehensiveAPI = ComprehensiveAPIWithoutStreamingOrRaw' (EmptyEndpoint :<|> StreamingEndpoint :<|> RawEndpoint)
type RawEndpoint = "raw" :> Raw
type StreamingEndpoint = "streaming" :> StreamBody' '[Description "netstring"] NetstringFraming JSON (SourceT IO Int) :> Stream  'GET 200 NetstringFraming JSON (SourceT IO Int)
type EmptyEndpoint = "empty-api" :> EmptyAPI
comprehensiveAPI :: Proxy ComprehensiveAPI
type ComprehensiveAPIWithoutRaw = ComprehensiveAPIWithoutStreamingOrRaw' (EmptyEndpoint :<|> StreamingEndpoint)
comprehensiveAPIWithoutRaw :: Proxy ComprehensiveAPIWithoutRaw
type ComprehensiveAPIWithoutStreaming = ComprehensiveAPIWithoutStreamingOrRaw' (EmptyEndpoint :<|> RawEndpoint)
comprehensiveAPIWithoutStreaming :: Proxy ComprehensiveAPIWithoutStreaming

-- | :: API -> API, so we have linear structure of the API.
type ComprehensiveAPIWithoutStreamingOrRaw' endpoint = GET :<|> "get-int" :> Get '[JSON] Int :<|> "capture" :> Capture' '[Description "example description"] "foo" Int :> GET :<|> "header" :> Header "foo" Int :> GET :<|> "header-lenient" :> Header' '[Required, Lenient] "bar" Int :> GET :<|> "http-version" :> HttpVersion :> GET :<|> "is-secure" :> IsSecure :> GET :<|> "param" :> QueryParam "foo" Int :> GET :<|> "param-lenient" :> QueryParam' '[Required, Lenient] "bar" Int :> GET :<|> "params" :> QueryParams "foo" Int :> GET :<|> "flag" :> QueryFlag "foo" :> GET :<|> "remote-host" :> RemoteHost :> GET :<|> "req-body" :> ReqBody '[JSON] Int :> GET :<|> "req-body-lenient" :> ReqBody' '[Lenient] '[JSON] Int :> GET :<|> "res-headers" :> Get '[JSON] (Headers '[Header "foo" Int] NoContent) :<|> "foo" :> GET :<|> "vault" :> Vault :> GET :<|> "post-no-content" :> Verb  'POST 204 '[JSON] NoContent :<|> "post-int" :> Verb  'POST 204 '[JSON] Int :<|> "named-context" :> WithNamedContext "foo" '[] GET :<|> "capture-all" :> CaptureAll "foo" Int :> GET :<|> "summary" :> Summary "foo" :> GET :<|> "description" :> Description "foo" :> GET :<|> "alternative" :> ("left" :> GET :<|> "right" :> GET) :<|> endpoint
type ComprehensiveAPIWithoutStreamingOrRaw = ComprehensiveAPIWithoutStreamingOrRaw' EmptyEndpoint
comprehensiveAPIWithoutStreamingOrRaw :: Proxy ComprehensiveAPIWithoutStreamingOrRaw

-- | Deprecated: Use Servant.TestComprehensiveAPI
module Servant.API.Internal.Test.ComprehensiveAPI

-- | Deprecated: Use Servant.Links.
module Servant.Utils.Links
