git.iko.soy/typeable/servant
on master help sign in
Remove matrix params
commitc6dfac5203daf7b4ca0359633671ee5689070ee9 authorJulian K. Arni <jkarni@gmail.com> dateWed 27 Jan 2016, 22:49 (11 years ago) parentf601cbf
1 file changed+1−21
doc/tutorial/ApiType.lhs+1−21
doc/tutorial/ApiType.lhs+1−21
@@ -142,7 +142,7 @@ type UserAPI5 = "user" :> Capture "userid" Integer :> Get '[JSON] User
142142 -- equivalent to 'DELETE /user/:userid'
143143```
144144
145−### `QueryParam`, `QueryParams`, `QueryFlag`, `MatrixParam`, `MatrixParams` and `MatrixFlag`
145+### `QueryParam`, `QueryParams`, `QueryFlag`
146146
147147`QueryParam`, `QueryParams` and `QueryFlag` are about query string
148148parameters, i.e., those parameters that come after the question mark
@@ -165,32 +165,12 @@ data QueryParams (sym :: Symbol) a
165165data QueryFlag (sym :: Symbol)
166166```
167167
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−
186168Examples:
187169
188170``` haskell
189171type UserAPI6 = "users" :> QueryParam "sortby" SortBy :> Get '[JSON] [User]
190172 -- equivalent to 'GET /users?sortby={age, name}'
191173
192− :<|> "users" :> MatrixParam "sortby" SortBy :> Get '[JSON] [User]
193− -- equivalent to 'GET /users;sortby={age, name}'
194174```
195175
196176Again, your handlers don't have to deserialize these things (into, for example,