@@ -830,7 +830,7 @@ type UserAPI3 = -- view the user with given userid, in JSON
830830 Capture "userid" Int :> Get '[JSON] User
831831
832832 :<|> -- delete the user with given userid. empty response
833− Capture "userid" Int :> DeleteNoContent '[JSON] NoContent
833+ Capture "userid" Int :> DeleteNoContent
834834```
835835
836836We can instead factor out the `userid`:
@@ -838,7 +838,7 @@ We can instead factor out the `userid`:
838838``` haskell
839839type UserAPI4 = Capture "userid" Int :>
840840 ( Get '[JSON] User
841− :<|> DeleteNoContent '[JSON] NoContent
841+ :<|> DeleteNoContent
842842 )
843843```
844844
@@ -896,13 +896,13 @@ type API1 = "users" :>
896896-- we factor out the Request Body
897897type API2 = ReqBody '[JSON] User :>
898898 ( Get '[JSON] User -- just display the same user back, don't register it
899− :<|> PostNoContent '[JSON] NoContent -- register the user. empty response
899+ :<|> PostNoContent -- register the user. empty response
900900 )
901901
902902-- we factor out a Header
903903type API3 = Header "Authorization" Token :>
904904 ( Get '[JSON] SecretData -- get some secret data, if authorized
905− :<|> ReqBody '[JSON] SecretData :> PostNoContent '[JSON] NoContent -- add some secret data, if authorized
905+ :<|> ReqBody '[JSON] SecretData :> PostNoContent -- add some secret data, if authorized
906906 )
907907
908908newtype Token = Token ByteString
@@ -915,11 +915,11 @@ API type only at the end.
915915``` haskell
916916type UsersAPI =
917917 Get '[JSON] [User] -- list users
918− :<|> ReqBody '[JSON] User :> PostNoContent '[JSON] NoContent -- add a user
918+ :<|> ReqBody '[JSON] User :> PostNoContent -- add a user
919919 :<|> Capture "userid" Int :>
920920 ( Get '[JSON] User -- view a user
921− :<|> ReqBody '[JSON] User :> PutNoContent '[JSON] NoContent -- update a user
922− :<|> DeleteNoContent '[JSON] NoContent -- delete a user
921+ :<|> ReqBody '[JSON] User :> PutNoContent -- update a user
922+ :<|> DeleteNoContent -- delete a user
923923 )
924924
925925usersServer :: Server UsersAPI
@@ -948,11 +948,11 @@ usersServer = getUsers :<|> newUser :<|> userOperations
948948``` haskell
949949type ProductsAPI =
950950 Get '[JSON] [Product] -- list products
951− :<|> ReqBody '[JSON] Product :> PostNoContent '[JSON] NoContent -- add a product
951+ :<|> ReqBody '[JSON] Product :> PostNoContent -- add a product
952952 :<|> Capture "productid" Int :>
953953 ( Get '[JSON] Product -- view a product
954− :<|> ReqBody '[JSON] Product :> PutNoContent '[JSON] NoContent -- update a product
955− :<|> DeleteNoContent '[JSON] NoContent -- delete a product
954+ :<|> ReqBody '[JSON] Product :> PutNoContent -- update a product
955+ :<|> DeleteNoContent -- delete a product
956956 )
957957
958958data Product = Product { productId :: Int }
@@ -996,11 +996,11 @@ abstract that away:
996996-- indexed by values of type 'i'
997997type APIFor a i =
998998 Get '[JSON] [a] -- list 'a's
999− :<|> ReqBody '[JSON] a :> PostNoContent '[JSON] NoContent -- add an 'a'
999+ :<|> ReqBody '[JSON] a :> PostNoContent -- add an 'a'
10001000 :<|> Capture "id" i :>
10011001 ( Get '[JSON] a -- view an 'a' given its "identifier" of type 'i'
1002− :<|> ReqBody '[JSON] a :> PutNoContent '[JSON] NoContent -- update an 'a'
1003− :<|> DeleteNoContent '[JSON] NoContent -- delete an 'a'
1002+ :<|> ReqBody '[JSON] a :> PutNoContent -- update an 'a'
1003+ :<|> DeleteNoContent -- delete an 'a'
10041004 )
10051005
10061006-- Build the appropriate 'Server'