| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Servant.QQ
Description
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 |]
Will generate:
"hello" :> ReqBody String :> Put () :<|> "hello" :> Capture "p" Int :> ReqBody String :> Post () :<|> "hello" :> QueryParam "name" String :> Get Int
Note the / before a QueryParam!
Documentation
The sitemap QuasiQuoter.
...var:type...becomes a capture.../?var:typebecomes a query parametermethod ... typbecomes a method returningtypmethod ... typ1 -> typ2becomes a method with request body oftyp1and returningtyp2
Comments are allowed, and have the standard Haskell format
--for inline{- ... -}for block