git.iko.soy/typeable/servant
on master help sign in
clean up Client and remove Setup binary
commitbc8efb246495c1ffe2f2485d3791380641194c02 authorBrandon Martin <zmbmartin@gmail.com> dateFri 8 May 2015, 17:51 (11 years ago) parent7c24c2a
4 files changed+32−33
servant-client/servant-client.cabal−1 servant-client/src/Servant/Client.hs+31−31 servant-client/test/Servant/ClientSpec.hs+1−1 servant/Setup
servant-client/servant-client.cabal−1
@@ -85,4 +85,3 @@ test-suite spec
8585 , text
8686 , wai
8787 , warp
88− , transformers
servant-client/src/Servant/Client.hs+31−31
@@ -59,10 +59,10 @@ client p baseurl = clientWithRoute p defReq baseurl
5959-- influences the creation of an HTTP request. It's mostly
6060-- an internal class, you can just use 'client'.
6161class HasClient layout where
62− type Client' layout :: *
63− clientWithRoute :: Proxy layout -> Req -> BaseUrl -> Client' layout
62+ type Client layout :: *
63+ clientWithRoute :: Proxy layout -> Req -> BaseUrl -> Client layout
6464
65−type Client layout = Client' layout
65+{-type Client layout = Client layout-}
6666
6767-- | A client querying function for @a ':<|>' b@ will actually hand you
6868-- one function for querying @a@ and another one for querying @b@,
@@ -78,7 +78,7 @@ type Client layout = Client' layout
7878-- > postNewBook :: Book -> BaseUrl -> EitherT String IO Book
7979-- > (getAllBooks :<|> postNewBook) = client myApi
8080instance (HasClient a, HasClient b) => HasClient (a :<|> b) where
81− type Client' (a :<|> b) = Client' a :<|> Client' b
81+ type Client (a :<|> b) = Client a :<|> Client b
8282 clientWithRoute Proxy req baseurl =
8383 clientWithRoute (Proxy :: Proxy a) req baseurl :<|>
8484 clientWithRoute (Proxy :: Proxy b) req baseurl
@@ -105,7 +105,7 @@ instance (HasClient a, HasClient b) => HasClient (a :<|> b) where
105105instance (KnownSymbol capture, ToText a, HasClient sublayout)
106106 => HasClient (Capture capture a :> sublayout) where
107107
108− type Client' (Capture capture a :> sublayout) =
108+ type Client (Capture capture a :> sublayout) =
109109 a -> Client sublayout
110110
111111 clientWithRoute Proxy req baseurl val =
@@ -124,7 +124,7 @@ instance
124124 {-# OVERLAPPABLE #-}
125125#endif
126126 (MimeUnrender ct a) => HasClient (Delete (ct ': cts) a) where
127− type Client' (Delete (ct ': cts) a) = EitherT ServantError IO a
127+ type Client (Delete (ct ': cts) a) = EitherT ServantError IO a
128128 clientWithRoute Proxy req baseurl =
129129 snd <$> performRequestCT (Proxy :: Proxy ct) H.methodDelete req [200, 202] baseurl
130130
@@ -135,7 +135,7 @@ instance
135135 {-# OVERLAPPING #-}
136136#endif
137137 HasClient (Delete (ct ': cts) ()) where
138− type Client' (Delete (ct ': cts) ()) = EitherT ServantError IO ()
138+ type Client (Delete (ct ': cts) ()) = EitherT ServantError IO ()
139139 clientWithRoute Proxy req baseurl =
140140 void $ performRequestNoBody H.methodDelete req [204] baseurl
141141
@@ -147,7 +147,7 @@ instance
147147#endif
148148 ( MimeUnrender ct a, BuildHeadersTo ls
149149 ) => HasClient (Delete (ct ': cts) (Headers ls a)) where
150− type Client' (Delete (ct ': cts) (Headers ls a)) = EitherT ServantError IO (Headers ls a)
150+ type Client (Delete (ct ': cts) (Headers ls a)) = EitherT ServantError IO (Headers ls a)
151151 clientWithRoute Proxy req baseurl = do
152152 (hdrs, resp) <- performRequestCT (Proxy :: Proxy ct) H.methodDelete req [200, 202] baseurl
153153 return $ Headers { getResponse = resp
@@ -163,7 +163,7 @@ instance
163163 {-# OVERLAPPABLE #-}
164164#endif
165165 (MimeUnrender ct result) => HasClient (Get (ct ': cts) result) where
166− type Client' (Get (ct ': cts) result) = EitherT ServantError IO result
166+ type Client (Get (ct ': cts) result) = EitherT ServantError IO result
167167 clientWithRoute Proxy req baseurl =
168168 snd <$> performRequestCT (Proxy :: Proxy ct) H.methodGet req [200, 203] baseurl
169169
@@ -174,7 +174,7 @@ instance
174174 {-# OVERLAPPING #-}
175175#endif
176176 HasClient (Get (ct ': cts) ()) where
177− type Client' (Get (ct ': cts) ()) = EitherT ServantError IO ()
177+ type Client (Get (ct ': cts) ()) = EitherT ServantError IO ()
178178 clientWithRoute Proxy req baseurl =
179179 performRequestNoBody H.methodGet req [204] baseurl
180180
@@ -186,7 +186,7 @@ instance
186186#endif
187187 ( MimeUnrender ct a, BuildHeadersTo ls
188188 ) => HasClient (Get (ct ': cts) (Headers ls a)) where
189− type Client' (Get (ct ': cts) (Headers ls a)) = EitherT ServantError IO (Headers ls a)
189+ type Client (Get (ct ': cts) (Headers ls a)) = EitherT ServantError IO (Headers ls a)
190190 clientWithRoute Proxy req baseurl = do
191191 (hdrs, resp) <- performRequestCT (Proxy :: Proxy ct) H.methodGet req [200, 203, 204] baseurl
192192 return $ Headers { getResponse = resp
@@ -221,7 +221,7 @@ instance
221221instance (KnownSymbol sym, ToText a, HasClient sublayout)
222222 => HasClient (Header sym a :> sublayout) where
223223
224− type Client' (Header sym a :> sublayout) =
224+ type Client (Header sym a :> sublayout) =
225225 Maybe a -> Client sublayout
226226
227227 clientWithRoute Proxy req baseurl mval =
@@ -243,7 +243,7 @@ instance
243243 {-# OVERLAPPABLE #-}
244244#endif
245245 (MimeUnrender ct a) => HasClient (Post (ct ': cts) a) where
246− type Client' (Post (ct ': cts) a) = EitherT ServantError IO a
246+ type Client (Post (ct ': cts) a) = EitherT ServantError IO a
247247 clientWithRoute Proxy req baseurl =
248248 snd <$> performRequestCT (Proxy :: Proxy ct) H.methodPost req [200,201] baseurl
249249
@@ -254,7 +254,7 @@ instance
254254 {-# OVERLAPPING #-}
255255#endif
256256 HasClient (Post (ct ': cts) ()) where
257− type Client' (Post (ct ': cts) ()) = EitherT ServantError IO ()
257+ type Client (Post (ct ': cts) ()) = EitherT ServantError IO ()
258258 clientWithRoute Proxy req baseurl =
259259 void $ performRequestNoBody H.methodPost req [204] baseurl
260260
@@ -266,7 +266,7 @@ instance
266266#endif
267267 ( MimeUnrender ct a, BuildHeadersTo ls
268268 ) => HasClient (Post (ct ': cts) (Headers ls a)) where
269− type Client' (Post (ct ': cts) (Headers ls a)) = EitherT ServantError IO (Headers ls a)
269+ type Client (Post (ct ': cts) (Headers ls a)) = EitherT ServantError IO (Headers ls a)
270270 clientWithRoute Proxy req baseurl = do
271271 (hdrs, resp) <- performRequestCT (Proxy :: Proxy ct) H.methodPost req [200, 201] baseurl
272272 return $ Headers { getResponse = resp
@@ -282,7 +282,7 @@ instance
282282 {-# OVERLAPPABLE #-}
283283#endif
284284 (MimeUnrender ct a) => HasClient (Put (ct ': cts) a) where
285− type Client' (Put (ct ': cts) a) = EitherT ServantError IO a
285+ type Client (Put (ct ': cts) a) = EitherT ServantError IO a
286286 clientWithRoute Proxy req baseurl =
287287 snd <$> performRequestCT (Proxy :: Proxy ct) H.methodPut req [200,201] baseurl
288288
@@ -293,7 +293,7 @@ instance
293293 {-# OVERLAPPING #-}
294294#endif
295295 HasClient (Put (ct ': cts) ()) where
296− type Client' (Put (ct ': cts) ()) = EitherT ServantError IO ()
296+ type Client (Put (ct ': cts) ()) = EitherT ServantError IO ()
297297 clientWithRoute Proxy req baseurl =
298298 void $ performRequestNoBody H.methodPut req [204] baseurl
299299
@@ -305,7 +305,7 @@ instance
305305#endif
306306 ( MimeUnrender ct a, BuildHeadersTo ls
307307 ) => HasClient (Put (ct ': cts) (Headers ls a)) where
308− type Client' (Put (ct ': cts) (Headers ls a)) = EitherT ServantError IO (Headers ls a)
308+ type Client (Put (ct ': cts) (Headers ls a)) = EitherT ServantError IO (Headers ls a)
309309 clientWithRoute Proxy req baseurl = do
310310 (hdrs, resp) <- performRequestCT (Proxy :: Proxy ct) H.methodPut req [200, 201] baseurl
311311 return $ Headers { getResponse = resp
@@ -321,7 +321,7 @@ instance
321321 {-# OVERLAPPABLE #-}
322322#endif
323323 (MimeUnrender ct a) => HasClient (Patch (ct ': cts) a) where
324− type Client' (Patch (ct ': cts) a) = EitherT ServantError IO a
324+ type Client (Patch (ct ': cts) a) = EitherT ServantError IO a
325325 clientWithRoute Proxy req baseurl =
326326 snd <$> performRequestCT (Proxy :: Proxy ct) H.methodPatch req [200,201] baseurl
327327
@@ -332,7 +332,7 @@ instance
332332 {-# OVERLAPPING #-}
333333#endif
334334 HasClient (Patch (ct ': cts) ()) where
335− type Client' (Patch (ct ': cts) ()) = EitherT ServantError IO ()
335+ type Client (Patch (ct ': cts) ()) = EitherT ServantError IO ()
336336 clientWithRoute Proxy req baseurl =
337337 void $ performRequestNoBody H.methodPatch req [204] baseurl
338338
@@ -344,7 +344,7 @@ instance
344344#endif
345345 ( MimeUnrender ct a, BuildHeadersTo ls
346346 ) => HasClient (Patch (ct ': cts) (Headers ls a)) where
347− type Client' (Patch (ct ': cts) (Headers ls a)) = EitherT ServantError IO (Headers ls a)
347+ type Client (Patch (ct ': cts) (Headers ls a)) = EitherT ServantError IO (Headers ls a)
348348 clientWithRoute Proxy req baseurl = do
349349 (hdrs, resp) <- performRequestCT (Proxy :: Proxy ct) H.methodPatch req [200, 201, 204] baseurl
350350 return $ Headers { getResponse = resp
@@ -379,7 +379,7 @@ instance
379379instance (KnownSymbol sym, ToText a, HasClient sublayout)
380380 => HasClient (QueryParam sym a :> sublayout) where
381381
382− type Client' (QueryParam sym a :> sublayout) =
382+ type Client (QueryParam sym a :> sublayout) =
383383 Maybe a -> Client sublayout
384384
385385 -- if mparam = Nothing, we don't add it to the query string
@@ -425,7 +425,7 @@ instance (KnownSymbol sym, ToText a, HasClient sublayout)
425425instance (KnownSymbol sym, ToText a, HasClient sublayout)
426426 => HasClient (QueryParams sym a :> sublayout) where
427427
428− type Client' (QueryParams sym a :> sublayout) =
428+ type Client (QueryParams sym a :> sublayout) =
429429 [a] -> Client sublayout
430430
431431 clientWithRoute Proxy req baseurl paramlist =
@@ -464,7 +464,7 @@ instance (KnownSymbol sym, ToText a, HasClient sublayout)
464464instance (KnownSymbol sym, HasClient sublayout)
465465 => HasClient (QueryFlag sym :> sublayout) where
466466
467− type Client' (QueryFlag sym :> sublayout) =
467+ type Client (QueryFlag sym :> sublayout) =
468468 Bool -> Client sublayout
469469
470470 clientWithRoute Proxy req baseurl flag =
@@ -505,7 +505,7 @@ instance (KnownSymbol sym, HasClient sublayout)
505505instance (KnownSymbol sym, ToText a, HasClient sublayout)
506506 => HasClient (MatrixParam sym a :> sublayout) where
507507
508− type Client' (MatrixParam sym a :> sublayout) =
508+ type Client (MatrixParam sym a :> sublayout) =
509509 Maybe a -> Client sublayout
510510
511511 -- if mparam = Nothing, we don't add it to the query string
@@ -550,7 +550,7 @@ instance (KnownSymbol sym, ToText a, HasClient sublayout)
550550instance (KnownSymbol sym, ToText a, HasClient sublayout)
551551 => HasClient (MatrixParams sym a :> sublayout) where
552552
553− type Client' (MatrixParams sym a :> sublayout) =
553+ type Client (MatrixParams sym a :> sublayout) =
554554 [a] -> Client sublayout
555555
556556 clientWithRoute Proxy req baseurl paramlist =
@@ -589,7 +589,7 @@ instance (KnownSymbol sym, ToText a, HasClient sublayout)
589589instance (KnownSymbol sym, HasClient sublayout)
590590 => HasClient (MatrixFlag sym :> sublayout) where
591591
592− type Client' (MatrixFlag sym :> sublayout) =
592+ type Client (MatrixFlag sym :> sublayout) =
593593 Bool -> Client sublayout
594594
595595 clientWithRoute Proxy req baseurl flag =
@@ -605,9 +605,9 @@ instance (KnownSymbol sym, HasClient sublayout)
605605-- | Pick a 'Method' and specify where the server you want to query is. You get
606606-- back the full `Response`.
607607instance HasClient Raw where
608− type Client' Raw = H.Method -> EitherT ServantError IO (Int, ByteString, MediaType, [HTTP.Header], Response ByteString)
608+ type Client Raw = H.Method -> EitherT ServantError IO (Int, ByteString, MediaType, [HTTP.Header], Response ByteString)
609609
610− clientWithRoute :: Proxy Raw -> Req -> BaseUrl -> Client' Raw
610+ clientWithRoute :: Proxy Raw -> Req -> BaseUrl -> Client Raw
611611 clientWithRoute Proxy req baseurl httpMethod = do
612612 performRequest httpMethod req (const True) baseurl
613613
@@ -632,7 +632,7 @@ instance HasClient Raw where
632632instance (MimeRender ct a, HasClient sublayout)
633633 => HasClient (ReqBody (ct ': cts) a :> sublayout) where
634634
635− type Client' (ReqBody (ct ': cts) a :> sublayout) =
635+ type Client (ReqBody (ct ': cts) a :> sublayout) =
636636 a -> Client sublayout
637637
638638 clientWithRoute Proxy req baseurl body =
@@ -646,7 +646,7 @@ instance (MimeRender ct a, HasClient sublayout)
646646
647647-- | Make the querying function append @path@ to the request path.
648648instance (KnownSymbol path, HasClient sublayout) => HasClient (path :> sublayout) where
649− type Client' (path :> sublayout) = Client sublayout
649+ type Client (path :> sublayout) = Client sublayout
650650
651651 clientWithRoute Proxy req baseurl =
652652 clientWithRoute (Proxy :: Proxy sublayout)
servant-client/test/Servant/ClientSpec.hs+1−1
@@ -320,7 +320,7 @@ failSpec = withFailServer $ \ baseUrl -> do
320320
321321data WrappedApi where
322322 WrappedApi :: (HasServer api, Server api ~ EitherT ServantErr IO a,
323− HasClient api, Client' api ~ EitherT ServantError IO ()) =>
323+ HasClient api, Client api ~ EitherT ServantError IO ()) =>
324324 Proxy api -> WrappedApi
325325
326326
servant/Setupdeleted

Binary file not shown.