Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
Union of two APIs, first takes precedence in case of overlap.
Example:
type MyApi = "books" :> Get [Book] -- GET /books +
Safe Haskell None Language Haskell2010 Documentation
Union of two APIs, first takes precedence in case of overlap.
Example:
type MyApi = "books" :> Get [Book] -- GET /books :<|> "books" :> ReqBody Book :> Post Book -- POST /books
a :<|> b infixr 8
(HasServer a, HasServer b) => HasServer ((:<|>) a b) A server for
a
first tries to match the request again the route represented by:<|>
ba
and if it fails triesb
. You must provide a request handler for each route.type MyApi = "books" :> Get [Book] -- GET /books diff --git a/Servant-API-Capture.html b/Servant-API-Capture.html index 30f0100e..81d58e8b 100644 --- a/Servant-API-Capture.html +++ b/Servant-API-Capture.html @@ -1,7 +1,7 @@Servant.API.Capture
Safe Haskell None Language Haskell2010
- data Capture sym a
Documentation
Capture a value from the request path under a certain type
a
.Example:
-- GET /books/:isbn +
Safe Haskell None Language Haskell2010
- data Capture sym a
Documentation
Capture a value from the request path under a certain type
a
.Example:
-- GET /books/:isbn type MyApi = "books" :> Capture "isbn" Text :> Get Book
(KnownSymbol capture, FromText a, HasServer sublayout) => HasServer ((:>) * (Capture Symbol * capture a) sublayout) If you use
Capture
in one of the endpoints for your API, this automatically requires your server-side handler to be a function that takes an argument of the type specified by theCapture
. diff --git a/Servant-API-Delete.html b/Servant-API-Delete.html index 30c49f0d..28d1fb38 100644 --- a/Servant-API-Delete.html +++ b/Servant-API-Delete.html @@ -1,7 +1,7 @@Servant.API.Delete
Safe Haskell None Language Haskell2010
- data Delete
Documentation
Combinator for DELETE requests.
Example:
-- DELETE /books/:isbn +
Safe Haskell None Language Haskell2010
- data Delete
Documentation
Combinator for DELETE requests.
Example:
-- DELETE /books/:isbn type MyApi = "books" :> Capture "isbn" Text :> Delete
HasServer Delete If you have a
Delete
endpoint in your API, the handler for this endpoint is meant to delete a resource.The code of the handler will, just like diff --git a/Servant-API-Get.html b/Servant-API-Get.html index 3b3d294c..9bf56af2 100644 --- a/Servant-API-Get.html +++ b/Servant-API-Get.html @@ -1,7 +1,7 @@
Servant.API.Get
Safe Haskell None Language Haskell2010
- data Get a
Documentation
Endpoint for simple GET requests. Serves the result as JSON.
Example:
type MyApi = "books" :> Get [Book]
VLinkHelper * (Get x) ToJSON result => HasServer (Get result) When implementing the handler for a
Get
endpoint, +
Safe Haskell None Language Haskell2010
- data Get a
Documentation
Endpoint for simple GET requests. Serves the result as JSON.
Example:
type MyApi = "books" :> Get [Book]
VLinkHelper * (Get x) ToJSON result => HasServer (Get result) When implementing the handler for a
Get
endpoint, just like forDelete
,Post
andPut
, the handler code runs in theEitherT (Int, String) IO
monad, where theInt
represents diff --git a/Servant-API-Post.html b/Servant-API-Post.html index 3fe7bf2d..28aeea0f 100644 --- a/Servant-API-Post.html +++ b/Servant-API-Post.html @@ -1,7 +1,7 @@Servant.API.Post
Safe Haskell None Language Haskell2010
- data Post a
Documentation
Endpoint for POST requests. The type variable represents the type of the +
Safe Haskell None Language Haskell2010
- data Post a
Documentation
Endpoint for POST requests. The type variable represents the type of the response body (not the request body, use
RQBody
for that).Example:
-- POST /books -- with a JSON encoded Book as the request body diff --git a/Servant-API-Put.html b/Servant-API-Put.html index 745cfe56..761daee8 100644 --- a/Servant-API-Put.html +++ b/Servant-API-Put.html @@ -1,7 +1,7 @@Servant.API.Put
Safe Haskell None Language Haskell2010
- data Put a
Documentation
Endpoint for PUT requests, usually used to update a ressource. +
Safe Haskell None Language Haskell2010
- data Put a
Documentation
Endpoint for PUT requests, usually used to update a ressource. The type
a
is the type of the response body that's returned.Example:
-- PUT /books/:isbn -- with a Book as request body, returning the updated Book type MyApi = "books" :> Capture "isbn" Text :> ReqBody Book :> Put Book
ToJSON a => HasServer (Put a) When implementing the handler for a
Put
endpoint, diff --git a/Servant-API-QueryParam.html b/Servant-API-QueryParam.html index ff1ea9d7..e06394fa 100644 --- a/Servant-API-QueryParam.html +++ b/Servant-API-QueryParam.html @@ -1,7 +1,7 @@Servant.API.QueryParam
Safe Haskell None Language Haskell2010
- data QueryParam sym a
- data QueryParams sym a
- data QueryFlag sym
Documentation
data QueryParam sym a Source
Lookup the value associated to the
sym
query string parameter +
Safe Haskell None Language Haskell2010
- data QueryParam sym a
- data QueryParams sym a
- data QueryFlag sym
Documentation
data QueryParam sym a Source
Lookup the value associated to the
sym
query string parameter and try to extract it as a value of typea
.Example:
-- /books?author=<author name> type MyApi = "books" :> QueryParam "author" Text :> Get [Book]
(KnownSymbol sym, FromText a, HasServer sublayout) => HasServer ((:>) * (QueryParam Symbol * sym a) sublayout) If you use
in one of the endpoints for your API, this automatically requires your server-side handler to be a function diff --git a/Servant-API-Raw.html b/Servant-API-Raw.html index 21834152..51dfd7fc 100644 --- a/Servant-API-Raw.html +++ b/Servant-API-Raw.html @@ -1,7 +1,7 @@
QueryParam
"author" TextServant.API.Raw
Safe Haskell None Language Haskell2010
- data Raw
Documentation
Endpoint for plugging in your own Wai
Application
s.The given
Application
will get the request as received by the server, potentially with +
Safe Haskell None Language Haskell2010
- data Raw
Documentation
Endpoint for plugging in your own Wai
Application
s.The given
Application
will get the request as received by the server, potentially with a modified (stripped)pathInfo
if theApplication
is being routed with:>
.In addition to just letting you plug in your existing WAI
Application
s, this can also be used withserveDirectory
to serve static files stored in a particular directory on your filesystem, or to serve diff --git a/Servant-API-ReqBody.html b/Servant-API-ReqBody.html index fa32de1a..6696c2a0 100644 --- a/Servant-API-ReqBody.html +++ b/Servant-API-ReqBody.html @@ -1,7 +1,7 @@Servant.API.ReqBody
Safe Haskell None Language Haskell2010
- data ReqBody a
Documentation
Extract the request body as a value of type
a
.Example:
-- POST /books +
Safe Haskell None Language Haskell2010
- data ReqBody a
Documentation
Extract the request body as a value of type
a
.Example:
-- POST /books type MyApi = "books" :> ReqBody Book :> Post Book
(FromJSON a, HasServer sublayout) => HasServer ((:>) * (ReqBody * a) sublayout) If you use
ReqBody
in one of the endpoints for your API, this automatically requires your server-side handler to be a function that takes an argument of the type specified byReqBody
. diff --git a/Servant-API-Sub.html b/Servant-API-Sub.html index 6376dd4a..464947fd 100644 --- a/Servant-API-Sub.html +++ b/Servant-API-Sub.html @@ -1,7 +1,7 @@Servant.API.Sub
Safe Haskell None Language Haskell2010 Documentation
data path :> a infixr 9 Source
The contained API (second argument) can be found under
("/" ++ path)
+
Safe Haskell None Language Haskell2010 Documentation
data path :> a infixr 9 Source
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 World
(KnownSymbol s, VLinkHelper * e) => VLinkHelper * ((:>) Symbol s e) (KnownSymbol capture, FromText a, HasServer sublayout) => HasServer ((:>) * (Capture Symbol * capture a) sublayout) If you use
Capture
in one of the endpoints for your API, diff --git a/Servant-API.html b/Servant-API.html index de67263d..68ce77c5 100644 --- a/Servant-API.html +++ b/Servant-API.html @@ -1,4 +1,4 @@Servant.API \ No newline at end of file +
Safe Haskell None Language Haskell2010
- module Servant.API.Sub
- module Servant.API.Alternative
- module Servant.API.Capture
- module Servant.API.QueryParam
- module Servant.API.ReqBody
- module Servant.API.Get
- module Servant.API.Post
- module Servant.API.Delete
- module Servant.API.Put
- module Servant.API.Raw
- module Servant.Utils.StaticFiles
- module Servant.QQ
- module Servant.Utils.Links
Combinators
Type-level combinator for expressing subrouting:
:>
module Servant.API.Sub
Type-level combinator for alternative endpoints:
:<|>
module Servant.API.Alternative
Accessing information from the request
Capturing parts of the url path as parsed values:
Capture
module Servant.API.Capture
Retrieving parameters from the query string of the
URI
:
QueryParam
module Servant.API.QueryParam
Accessing the request body as a JSON-encoded type:
ReqBody
module Servant.API.ReqBody
Actual endpoints, distinguished by HTTP method
GET requests
module Servant.API.Get
POST requests
module Servant.API.Post
DELETE requests
module Servant.API.Delete
PUT requests
module Servant.API.Put
Untyped endpoints
Plugging in a wai
Application
, serving directoriesmodule Servant.API.Raw
module Servant.Utils.StaticFiles
Utilities
QuasiQuotes for endpoints
module Servant.QQ
Type-safe internal URLs
module Servant.Utils.Links
\ No newline at end of file diff --git a/Servant-Common-Text.html b/Servant-Common-Text.html index 8ce17b95..be547e71 100644 --- a/Servant-Common-Text.html +++ b/Servant-Common-Text.html @@ -1,7 +1,7 @@
Safe Haskell None Language Haskell2010
- module Servant.API.Sub
- module Servant.API.Alternative
- module Servant.API.Capture
- module Servant.API.QueryParam
- module Servant.API.ReqBody
- module Servant.API.Get
- module Servant.API.Post
- module Servant.API.Delete
- module Servant.API.Put
- module Servant.API.Raw
- module Servant.Utils.StaticFiles
- module Servant.QQ
- module Servant.Utils.Links
Combinators
Type-level combinator for expressing subrouting:
:>
module Servant.API.Sub
Type-level combinator for alternative endpoints:
:<|>
module Servant.API.Alternative
Accessing information from the request
Capturing parts of the url path as parsed values:
Capture
module Servant.API.Capture
Retrieving parameters from the query string of the
URI
:
QueryParam
module Servant.API.QueryParam
Accessing the request body as a JSON-encoded type:
ReqBody
module Servant.API.ReqBody
Actual endpoints, distinguished by HTTP method
GET requests
module Servant.API.Get
POST requests
module Servant.API.Post
DELETE requests
module Servant.API.Delete
PUT requests
module Servant.API.Put
Untyped endpoints
Plugging in a wai
Application
, serving directoriesmodule Servant.API.Raw
module Servant.Utils.StaticFiles
Utilities
QuasiQuotes for endpoints
module Servant.QQ
Type-safe internal URLs
module Servant.Utils.Links
Servant.Common.Text
Safe Haskell Safe-Inferred Language Haskell2010 Documentation
For getting values from url captures and query string parameters
FromText Bool fromText "true" = Just True +\ No newline at end of file diff --git a/Servant-QQ.html b/Servant-QQ.html index 0f12ce8c..1ebf37b6 100644 --- a/Servant-QQ.html +++ b/Servant-QQ.html @@ -1,7 +1,7 @@
Safe Haskell Safe-Inferred Language Haskell2010 Documentation
For getting values from url captures and query string parameters
FromText Bool fromText "true" = Just True fromText "false" = Just False fromText _ = NothingFromText Double FromText Float FromText Int FromText Int8 FromText Int16 FromText Int32 FromText Int64 FromText Integer FromText Word FromText Word8 FromText Word16 FromText Word32 FromText Word64 FromText String FromText Text For putting values in paths and query string parameters
Servant.QQ
Safe Haskell None Language Haskell2010 QuasiQuoting utilities for API types.
sitemap
allows you to write your type in a very natural way:[sitemap| +
Safe Haskell None Language Haskell2010 QuasiQuoting utilities for API types.
sitemap
allows you to write your type in a very natural way:[sitemap| PUT hello String -> () POST hello/p:Int String -> () GET hello/?name:String Int diff --git a/Servant-Server.html b/Servant-Server.html index c52cc4ae..8a12442c 100644 --- a/Servant-Server.html +++ b/Servant-Server.html @@ -1,7 +1,7 @@Servant.Server
Safe Haskell None Language Haskell2010 This module lets you implement
Server
s for defined APIs. You'll +
Safe Haskell None Language Haskell2010
- serve :: HasServer layout => Proxy layout -> Server layout -> Application
- toApplication :: RoutingApplication -> Application
- data RouteMismatch
- newtype RouteResult a = RR {}
- failWith :: RouteMismatch -> RouteResult a
- succeedWith :: a -> RouteResult a
- isMismatch :: RouteResult a -> Bool
- type RoutingApplication = Request -> (RouteResult Response -> IO ResponseReceived) -> IO ResponseReceived
- class HasServer layout where
- type Server layout :: *
- route :: Proxy layout -> Server layout -> RoutingApplication
Implementing Servers
serve :: HasServer layout => Proxy layout -> Server layout -> Application Source
serve
allows you to implement an API and produce a waiApplication
.Example:
type MyApi = "books" :> Get [Book] -- GET /books :<|> "books" :> ReqBody Book :> Post Book -- POST /books diff --git a/Servant-Utils-Links.html b/Servant-Utils-Links.html index 1a0ddc64..4a8c1bee 100644 --- a/Servant-Utils-Links.html +++ b/Servant-Utils-Links.html @@ -1,7 +1,7 @@Servant.Utils.Links
Safe Haskell None Language Haskell2010 Type safe internal links.
Provides the function
mkLink
:type API = Proxy ("hello" :> Get Int +
Safe Haskell None Language Haskell2010 Type safe internal links.
Provides the function
mkLink
:type API = Proxy ("hello" :> Get Int :| "bye" :> QueryParam "name" String :> Post Bool) api :: API diff --git a/Servant-Utils-StaticFiles.html b/Servant-Utils-StaticFiles.html index 8198ec69..522d1be2 100644 --- a/Servant-Utils-StaticFiles.html +++ b/Servant-Utils-StaticFiles.html @@ -1,7 +1,7 @@Servant.Utils.StaticFiles
Safe Haskell None Language Haskell2010 This module defines a sever-side handler that lets you serve static files.
serveDirectory
lets you serve anything that lives under a particular +
Safe Haskell None Language Haskell2010 This module defines a sever-side handler that lets you serve static files.
serveDirectory
lets you serve anything that lives under a particular directory on your filesystem.
- serveDirectory :: FilePath -> Server Raw
Documentation
serveDirectory :: FilePath -> Server Raw Source
Serve anything under the specified directory as a
Raw
endpoint.type MyApi = "static" :> Raw server :: Server MyApi diff --git a/Servant.html b/Servant.html index 6a794a2c..3e4e0d84 100644 --- a/Servant.html +++ b/Servant.html @@ -1,6 +1,6 @@Servant
Safe Haskell None Language Haskell2010
- module Servant.API
- module Servant.Server
- module Servant.Common.Text
- module Servant.QQ
- module Servant.Utils.Links
- module Servant.Utils.StaticFiles
- data Proxy t :: k -> * = Proxy
Documentation
This module and its submodules can be used to define servant APIs. Note +
\ No newline at end of file diff --git a/doc-index.html b/doc-index.html index 1187dac7..986b4f09 100644 --- a/doc-index.html +++ b/doc-index.html @@ -1,4 +1,4 @@ -
Safe Haskell None Language Haskell2010
- module Servant.API
- module Servant.Server
- module Servant.Common.Text
- module Servant.QQ
- module Servant.Utils.Links
- module Servant.Utils.StaticFiles
- data Proxy t :: k -> * = Proxy
Documentation
This module and its submodules can be used to define servant APIs. Note that these API definitions don't directly implement a server (or anything else).
module Servant.API
For implementing servers for servant APIs.
module Servant.Server
Using your types in request paths and query string parameters
module Servant.Common.Text
Utilities on top of the servant core
module Servant.QQ
module Servant.Utils.Links
module Servant.Utils.StaticFiles
Useful re-exports
data Proxy t :: k -> *
A concrete, poly-kinded proxy type
servant-0.2 (Index) \ No newline at end of file +
:<|> 1 (Type/Class) Servant.API.Alternative, Servant.API, Servant 2 (Data Constructor) Servant.API.Alternative, Servant.API, Servant :> 1 (Type/Class) Servant.API.Sub, Servant.API, Servant 2 (Data Constructor) Servant.API.Sub, Servant.API, Servant >: Servant.QQ, Servant And Servant.Utils.Links, Servant blockComment Servant.QQ, Servant Capture Servant.API.Capture, Servant.API, Servant capture Servant.QQ, Servant conj Servant.QQ, Servant Delete Servant.API.Delete, Servant.API, Servant delete Servant.QQ, Servant eol Servant.QQ, Servant eols Servant.QQ, Servant ExpSYM Servant.QQ, Servant failWith Servant.Server, Servant FromText Servant.Common.Text, Servant fromText Servant.Common.Text, Servant Get Servant.API.Get, Servant.API, Servant get Servant.QQ, Servant HasServer Servant.Server, Servant inlineComment Servant.QQ, Servant InvalidBody Servant.Server, Servant IsElem Servant.Utils.Links, Servant IsLink Servant.Utils.Links, Servant IsLink' Servant.Utils.Links, Servant IsLink'' Servant.Utils.Links, Servant isMismatch Servant.Server, Servant Link 1 (Type/Class) Servant.Utils.Links, Servant 2 (Data Constructor) Servant.Utils.Links, Servant lit Servant.QQ, Servant mkLink Servant.Utils.Links, Servant.API, Servant NotFound Servant.Server, Servant Or Servant.Utils.Links, Servant parseAll Servant.QQ, Servant parseEntry Servant.QQ, Servant parseMethod Servant.QQ, Servant parseTyp Servant.QQ, Servant parseUrl Servant.QQ, Servant parseUrlSegment Servant.QQ, Servant Post Servant.API.Post, Servant.API, Servant post Servant.QQ, Servant Proxy 1 (Data Constructor) Servant 2 (Type/Class) Servant Put Servant.API.Put, Servant.API, Servant put Servant.QQ, Servant QueryFlag Servant.API.QueryParam, Servant.API, Servant QueryParam Servant.API.QueryParam, Servant.API, Servant queryParam Servant.QQ, Servant QueryParams Servant.API.QueryParam, Servant.API, Servant Raw Servant.API.Raw, Servant.API, Servant ReqArgVal Servant.QQ, Servant ReqBody Servant.API.ReqBody, Servant.API, Servant reqBody Servant.QQ, Servant route Servant.Server, Servant RouteMismatch Servant.Server, Servant RouteResult Servant.Server, Servant routeResult Servant.Server, Servant RoutingApplication Servant.Server, Servant RR Servant.Server, Servant serve Servant.Server, Servant serveDirectory Servant.Utils.StaticFiles, Servant.API, Servant Server Servant.Server, Servant sitemap Servant.QQ, Servant.API, Servant succeedWith Servant.Server, Servant toApplication Servant.Server, Servant ToText Servant.Common.Text, Servant toText Servant.Common.Text, Servant Typ Servant.QQ, Servant Val Servant.QQ, Servant ValidLinkIn Servant.Utils.Links, Servant vlh Servant.Utils.Links, Servant VLinkHelper Servant.Utils.Links, Servant WrongMethod Servant.Server, Servant \ No newline at end of file diff --git a/index-frames.html b/index-frames.html index 8697ba67..6603aca3 100644 --- a/index-frames.html +++ b/index-frames.html @@ -1,4 +1,4 @@ -
:<|> 1 (Type/Class) Servant.API.Alternative, Servant.API, Servant 2 (Data Constructor) Servant.API.Alternative, Servant.API, Servant :> 1 (Type/Class) Servant.API.Sub, Servant.API, Servant 2 (Data Constructor) Servant.API.Sub, Servant.API, Servant >: Servant.QQ, Servant And Servant.Utils.Links, Servant blockComment Servant.QQ, Servant Capture Servant.API.Capture, Servant.API, Servant capture Servant.QQ, Servant conj Servant.QQ, Servant Delete Servant.API.Delete, Servant.API, Servant delete Servant.QQ, Servant eol Servant.QQ, Servant eols Servant.QQ, Servant ExpSYM Servant.QQ, Servant failWith Servant.Server, Servant FromText Servant.Common.Text, Servant fromText Servant.Common.Text, Servant Get Servant.API.Get, Servant.API, Servant get Servant.QQ, Servant HasServer Servant.Server, Servant inlineComment Servant.QQ, Servant InvalidBody Servant.Server, Servant IsElem Servant.Utils.Links, Servant IsLink Servant.Utils.Links, Servant IsLink' Servant.Utils.Links, Servant IsLink'' Servant.Utils.Links, Servant isMismatch Servant.Server, Servant Link 1 (Type/Class) Servant.Utils.Links, Servant 2 (Data Constructor) Servant.Utils.Links, Servant lit Servant.QQ, Servant mkLink Servant.Utils.Links, Servant.API, Servant NotFound Servant.Server, Servant Or Servant.Utils.Links, Servant parseAll Servant.QQ, Servant parseEntry Servant.QQ, Servant parseMethod Servant.QQ, Servant parseTyp Servant.QQ, Servant parseUrl Servant.QQ, Servant parseUrlSegment Servant.QQ, Servant Post Servant.API.Post, Servant.API, Servant post Servant.QQ, Servant Proxy 1 (Data Constructor) Servant 2 (Type/Class) Servant Put Servant.API.Put, Servant.API, Servant put Servant.QQ, Servant QueryFlag Servant.API.QueryParam, Servant.API, Servant QueryParam Servant.API.QueryParam, Servant.API, Servant queryParam Servant.QQ, Servant QueryParams Servant.API.QueryParam, Servant.API, Servant Raw Servant.API.Raw, Servant.API, Servant ReqArgVal Servant.QQ, Servant ReqBody Servant.API.ReqBody, Servant.API, Servant reqBody Servant.QQ, Servant route Servant.Server, Servant RouteMismatch Servant.Server, Servant RouteResult Servant.Server, Servant routeResult Servant.Server, Servant RoutingApplication Servant.Server, Servant RR Servant.Server, Servant serve Servant.Server, Servant serveDirectory Servant.Utils.StaticFiles, Servant.API, Servant Server Servant.Server, Servant sitemap Servant.QQ, Servant.API, Servant succeedWith Servant.Server, Servant toApplication Servant.Server, Servant ToText Servant.Common.Text, Servant toText Servant.Common.Text, Servant Typ Servant.QQ, Servant Val Servant.QQ, Servant ValidLinkIn Servant.Utils.Links, Servant vlh Servant.Utils.Links, Servant VLinkHelper Servant.Utils.Links, Servant WrongMethod Servant.Server, Servant servant-0.2 \ No newline at end of file diff --git a/index.html b/index.html index d18ea030..e6a7a52b 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,4 @@ -servant-0.2 \ No newline at end of file +servant-0.2
\ No newline at end of file diff --git a/servant.txt b/servant.txt index d34cc636..8ed014f5 100644 --- a/servant.txt +++ b/servant.txt @@ -2,6 +2,8 @@ -- See Hoogle, http://www.haskell.org/hoogle/ +-- | A family of combinators for defining webservices APIs and serving them +-- @package servant @version 0.2servant-0.2: A family of combinators for defining webservices APIs and serving them