Hoogle Search

Within LTS Haskell 24.58 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. module Servant.API.ResponseHeaders

    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).

  2. class AddHeader (mods :: [Type]) (h :: Symbol) v orig new | mods h v orig -> new, new -> mods, new -> h, new -> v, new -> orig

    servant Servant.API.ResponseHeaders

    No documentation available.

  3. class BuildHeadersTo (hs :: [Type])

    servant Servant.API.ResponseHeaders

    No documentation available.

  4. class GetHeaders ls

    servant Servant.API.ResponseHeaders

    No documentation available.

  5. class GetHeaders' (hs :: [Type])

    servant Servant.API.ResponseHeaders

    Auxiliary class for GetHeaders (Headers hs a) instance

  6. class HasResponseHeader (h :: Symbol) a (headers :: [Type])

    servant Servant.API.ResponseHeaders

    No documentation available.

  7. MissingHeader :: ResponseHeader (sym :: Symbol) a

    servant Servant.API.ResponseHeaders

    No documentation available.

  8. data ResponseHeader (sym :: Symbol) a

    servant Servant.API.ResponseHeaders

    No documentation available.

  9. UndecodableHeader :: ByteString -> ResponseHeader (sym :: Symbol) a

    servant Servant.API.ResponseHeaders

    No documentation available.

  10. addHeader :: forall (h :: Symbol) v orig new . AddHeader '[Optional, Strict] h v orig new => v -> orig -> new

    servant Servant.API.ResponseHeaders

    addHeader adds a header to a response. Note that it changes the type of the value in the following ways:

    1. A simple value is wrapped in "Headers '[hdr]":
    >>> let example0 = addHeader 5 "hi" :: Headers '[Header "someheader" Int] String;
    
    >>> getHeaders example0
    [("someheader","5")]
    
    1. 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.

Page 147 of many | Previous | Next