@@ -8,9 +8,8 @@
88{-# LANGUAGE TypeFamilies #-}
99{-# LANGUAGE TypeOperators #-}
1010{-# LANGUAGE UndecidableInstances #-}
11−#if !MIN_VERSION_base(4,8,0)
12−{-# LANGUAGE OverlappingInstances #-}
13−#endif
11+
12+#include "overlapping-compat.h"
1413-- | This module provides 'client' which can automatically generate
1514-- querying functions for each endpoint just from the type representing your
1615-- API.
@@ -123,19 +122,13 @@ instance (KnownSymbol capture, ToHttpApiData a, HasClient sublayout)
123122-- side querying function that is created when calling 'client'
124123-- will just require an argument that specifies the scheme, host
125124-- and port to send the request to.
126−instance
127−#if MIN_VERSION_base(4,8,0)
128− {-# OVERLAPPABLE #-}
129−#endif
125+instance OVERLAPPABLE_
130126 (MimeUnrender ct a, cts' ~ (ct ': cts)) => HasClient (Delete cts' a) where
131127 type Client (Delete cts' a) = ExceptT ServantError IO a
132128 clientWithRoute Proxy req baseurl manager =
133129 snd <$> performRequestCT (Proxy :: Proxy ct) H.methodDelete req baseurl manager
134130
135−instance
136−#if MIN_VERSION_base(4,8,0)
137− {-# OVERLAPPING #-}
138−#endif
131+instance OVERLAPPING_
139132 HasClient (Delete cts ()) where
140133 type Client (Delete cts ()) = ExceptT ServantError IO ()
141134 clientWithRoute Proxy req baseurl manager =
@@ -143,10 +136,7 @@ instance
143136
144137-- | If you have a 'Delete xs (Headers ls x)' endpoint, the client expects the
145138-- corresponding headers.
146−instance
147−#if MIN_VERSION_base(4,8,0)
148− {-# OVERLAPPING #-}
149−#endif
139+instance OVERLAPPING_
150140 ( MimeUnrender ct a, BuildHeadersTo ls, cts' ~ (ct ': cts)
151141 ) => HasClient (Delete cts' (Headers ls a)) where
152142 type Client (Delete cts' (Headers ls a)) = ExceptT ServantError IO (Headers ls a)
@@ -160,19 +150,13 @@ instance
160150-- side querying function that is created when calling 'client'
161151-- will just require an argument that specifies the scheme, host
162152-- and port to send the request to.
163−instance
164−#if MIN_VERSION_base(4,8,0)
165− {-# OVERLAPPABLE #-}
166−#endif
153+instance OVERLAPPABLE_
167154 (MimeUnrender ct result) => HasClient (Get (ct ': cts) result) where
168155 type Client (Get (ct ': cts) result) = ExceptT ServantError IO result
169156 clientWithRoute Proxy req baseurl manager =
170157 snd <$> performRequestCT (Proxy :: Proxy ct) H.methodGet req baseurl manager
171158
172−instance
173−#if MIN_VERSION_base(4,8,0)
174− {-# OVERLAPPING #-}
175−#endif
159+instance OVERLAPPING_
176160 HasClient (Get (ct ': cts) ()) where
177161 type Client (Get (ct ': cts) ()) = ExceptT ServantError IO ()
178162 clientWithRoute Proxy req baseurl manager =
@@ -180,10 +164,7 @@ instance
180164
181165-- | If you have a 'Get xs (Headers ls x)' endpoint, the client expects the
182166-- corresponding headers.
183−instance
184−#if MIN_VERSION_base(4,8,0)
185− {-# OVERLAPPING #-}
186−#endif
167+instance OVERLAPPING_
187168 ( MimeUnrender ct a, BuildHeadersTo ls
188169 ) => HasClient (Get (ct ': cts) (Headers ls a)) where
189170 type Client (Get (ct ': cts) (Headers ls a)) = ExceptT ServantError IO (Headers ls a)
@@ -240,19 +221,13 @@ instance (KnownSymbol sym, ToHttpApiData a, HasClient sublayout)
240221-- side querying function that is created when calling 'client'
241222-- will just require an argument that specifies the scheme, host
242223-- and port to send the request to.
243−instance
244−#if MIN_VERSION_base(4,8,0)
245− {-# OVERLAPPABLE #-}
246−#endif
224+instance OVERLAPPABLE_
247225 (MimeUnrender ct a) => HasClient (Post (ct ': cts) a) where
248226 type Client (Post (ct ': cts) a) = ExceptT ServantError IO a
249227 clientWithRoute Proxy req baseurl manager =
250228 snd <$> performRequestCT (Proxy :: Proxy ct) H.methodPost req baseurl manager
251229
252−instance
253−#if MIN_VERSION_base(4,8,0)
254− {-# OVERLAPPING #-}
255−#endif
230+instance OVERLAPPING_
256231 HasClient (Post (ct ': cts) ()) where
257232 type Client (Post (ct ': cts) ()) = ExceptT ServantError IO ()
258233 clientWithRoute Proxy req baseurl manager =
@@ -260,10 +235,7 @@ instance
260235
261236-- | If you have a 'Post xs (Headers ls x)' endpoint, the client expects the
262237-- corresponding headers.
263−instance
264−#if MIN_VERSION_base(4,8,0)
265− {-# OVERLAPPING #-}
266−#endif
238+instance OVERLAPPING_
267239 ( MimeUnrender ct a, BuildHeadersTo ls
268240 ) => HasClient (Post (ct ': cts) (Headers ls a)) where
269241 type Client (Post (ct ': cts) (Headers ls a)) = ExceptT ServantError IO (Headers ls a)
@@ -277,19 +249,13 @@ instance
277249-- side querying function that is created when calling 'client'
278250-- will just require an argument that specifies the scheme, host
279251-- and port to send the request to.
280−instance
281−#if MIN_VERSION_base(4,8,0)
282− {-# OVERLAPPABLE #-}
283−#endif
252+instance OVERLAPPABLE_
284253 (MimeUnrender ct a) => HasClient (Put (ct ': cts) a) where
285254 type Client (Put (ct ': cts) a) = ExceptT ServantError IO a
286255 clientWithRoute Proxy req baseurl manager =
287256 snd <$> performRequestCT (Proxy :: Proxy ct) H.methodPut req baseurl manager
288257
289−instance
290−#if MIN_VERSION_base(4,8,0)
291− {-# OVERLAPPING #-}
292−#endif
258+instance OVERLAPPING_
293259 HasClient (Put (ct ': cts) ()) where
294260 type Client (Put (ct ': cts) ()) = ExceptT ServantError IO ()
295261 clientWithRoute Proxy req baseurl manager =
@@ -297,10 +263,7 @@ instance
297263
298264-- | If you have a 'Put xs (Headers ls x)' endpoint, the client expects the
299265-- corresponding headers.
300−instance
301−#if MIN_VERSION_base(4,8,0)
302− {-# OVERLAPPING #-}
303−#endif
266+instance OVERLAPPING_
304267 ( MimeUnrender ct a, BuildHeadersTo ls
305268 ) => HasClient (Put (ct ': cts) (Headers ls a)) where
306269 type Client (Put (ct ': cts) (Headers ls a)) = ExceptT ServantError IO (Headers ls a)
@@ -314,19 +277,13 @@ instance
314277-- side querying function that is created when calling 'client'
315278-- will just require an argument that specifies the scheme, host
316279-- and port to send the request to.
317−instance
318−#if MIN_VERSION_base(4,8,0)
319− {-# OVERLAPPABLE #-}
320−#endif
280+instance OVERLAPPABLE_
321281 (MimeUnrender ct a) => HasClient (Patch (ct ': cts) a) where
322282 type Client (Patch (ct ': cts) a) = ExceptT ServantError IO a
323283 clientWithRoute Proxy req baseurl manager =
324284 snd <$> performRequestCT (Proxy :: Proxy ct) H.methodPatch req baseurl manager
325285
326−instance
327−#if MIN_VERSION_base(4,8,0)
328− {-# OVERLAPPING #-}
329−#endif
286+instance OVERLAPPING_
330287 HasClient (Patch (ct ': cts) ()) where
331288 type Client (Patch (ct ': cts) ()) = ExceptT ServantError IO ()
332289 clientWithRoute Proxy req baseurl manager =
@@ -334,10 +291,7 @@ instance
334291
335292-- | If you have a 'Patch xs (Headers ls x)' endpoint, the client expects the
336293-- corresponding headers.
337−instance
338−#if MIN_VERSION_base(4,8,0)
339− {-# OVERLAPPING #-}
340−#endif
294+instance OVERLAPPING_
341295 ( MimeUnrender ct a, BuildHeadersTo ls
342296 ) => HasClient (Patch (ct ': cts) (Headers ls a)) where
343297 type Client (Patch (ct ': cts) (Headers ls a)) = ExceptT ServantError IO (Headers ls a)