git.iko.soy/typeable/servant
on master help sign in
Remove matrix params
c6dfac5Julian K. Arni
doc/tutorial/ApiType.lhs+1−21
@@ -142,7 +142,7 @@ type UserAPI5 = "user" :> Capture "userid" Integer :> Get '[JSON] User
142 -- equivalent to 'DELETE /user/:userid'
142 -- equivalent to 'DELETE /user/:userid'
143```
143```
144
144
145−### `QueryParam`, `QueryParams`, `QueryFlag`, `MatrixParam`, `MatrixParams` and `MatrixFlag`
145+### `QueryParam`, `QueryParams`, `QueryFlag`
146
146
147`QueryParam`, `QueryParams` and `QueryFlag` are about query string
147`QueryParam`, `QueryParams` and `QueryFlag` are about query string
148parameters, i.e., those parameters that come after the question mark
148parameters, i.e., those parameters that come after the question mark
@@ -165,32 +165,12 @@ data QueryParams (sym :: Symbol) a
165data QueryFlag (sym :: Symbol)
165data QueryFlag (sym :: Symbol)
166```
166```
167
167
168−[Matrix parameters](http://www.w3.org/DesignIssues/MatrixURIs.html)
169−are similar to query string parameters, but they can appear anywhere
170−in the paths (click the link for more details). A URL with matrix
171−parameters in it looks like `/users;sortby=age`, as opposed to
172−`/users?sortby=age` with query string parameters. The big advantage is
173−that they are not necessarily at the end of the URL. You could have
174−`/users;active=true;registered_after=2005-01-01/locations` to get
175−geolocation data about users whom are still active and registered
176−after *January 1st, 2005*.
177−
178−Corresponding data type declarations below.
179−
180−``` haskell ignore
181−data MatrixParam (sym :: Symbol) a
182−data MatrixParams (sym :: Symbol) a
183−data MatrixFlag (sym :: Symbol)
184−```
185−
186Examples:
168Examples:
187
169
188``` haskell
170``` haskell
189type UserAPI6 = "users" :> QueryParam "sortby" SortBy :> Get '[JSON] [User]
171type UserAPI6 = "users" :> QueryParam "sortby" SortBy :> Get '[JSON] [User]
190 -- equivalent to 'GET /users?sortby={age, name}'
172 -- equivalent to 'GET /users?sortby={age, name}'
191
173
192− :<|> "users" :> MatrixParam "sortby" SortBy :> Get '[JSON] [User]
193− -- equivalent to 'GET /users;sortby={age, name}'
194```
174```
195
175
196Again, your handlers don't have to deserialize these things (into, for example,
176Again, your handlers don't have to deserialize these things (into, for example,