git.iko.soy/typeable/servant
on master help sign in
Merge pull request #1009 from phadej/cleanup-pre-ghc-8.0

Cleanup pre-GHC-8.0 stuff

commit99e535b5790826c6fc9ba2badc9d7868ac600450 authorOleg Grenrus <oleg.grenrus@iki.fi> dateWed 11 Jul 2018, 10:10 (8 years ago) parent44d34dfcfade67
31 files changed+46−219
servant-client-core/include/overlapping-compat.h−8 servant-client-core/servant-client-core.cabal−6 servant-client-core/src/Servant/Client/Core/Internal/Generic.hs+1−4 servant-client-core/src/Servant/Client/Core/Internal/HasClient.hs+5−7 servant-client/include/overlapping-compat.h−8 servant-client/servant-client.cabal+1−12 servant-client/test/Servant/ClientSpec.hs−5 servant-client/test/Servant/StreamSpec.hs−5 servant-docs/include/overlapping-compat.h−8 servant-docs/servant-docs.cabal+1−9 servant-docs/src/Servant/Docs/Internal.hs+4−6 servant-docs/test/Servant/DocsSpec.hs−5 servant-foreign/include/overlapping-compat.h−8 servant-foreign/servant-foreign.cabal+1−10 servant-foreign/src/Servant/Foreign/Internal.hs−3 servant-foreign/test/Servant/ForeignSpec.hs+2−7 servant-server/Setup.lhs → servant-server/Setup.hs+5−3 servant-server/include/overlapping-compat.h−8 servant-server/servant-server.cabal+1−6 servant-server/src/Servant/Server/Internal.hs+4−6 servant-server/src/Servant/Server/Internal/Context.hs+2−5 servant-server/src/Servant/Server/StaticFiles.hs+1−10 servant-server/test/Servant/ServerSpec.hs−5 servant/Setup.lhs → servant/Setup.hs+5−3 servant/include/overlapping-compat.h−8 servant/servant.cabal+1−10 servant/src/Servant/API/ContentTypes.hs+8−16 servant/src/Servant/API/ResponseHeaders.hs+4−6 servant/src/Servant/API/TypeLevel.hs−15 servant/test/Servant/API/ContentTypesSpec.hs−3 servant/test/Servant/LinksSpec.hs−4
servant-client-core/include/overlapping-compat.hdeleted−8
@@ -1,8 +0,0 @@
1−#if __GLASGOW_HASKELL__ >= 710
2−#define OVERLAPPABLE_ {-# OVERLAPPABLE #-}
3−#define OVERLAPPING_ {-# OVERLAPPING #-}
4−#else
5−{-# LANGUAGE OverlappingInstances #-}
6−#define OVERLAPPABLE_
7−#define OVERLAPPING_
8−#endif
servant-client-core/servant-client-core.cabal−6
@@ -15,7 +15,6 @@ copyright: 2014-2016 Zalora South East Asia Pte Ltd, 2016-2017 Servant
1515category: Web
1616build-type: Simple
1717extra-source-files:
18− include/*.h
1918 CHANGELOG.md
2019 README.md
2120tested-with:
@@ -53,10 +52,6 @@ library
5352 , text >= 1.2.3.0 && < 1.3
5453 , transformers >= 0.3.0.0 && < 0.6
5554
56− if !impl(ghc >= 8.0)
57− build-depends:
58− semigroups >=0.18.4 && <0.19
59−
6055 -- Servant dependencies
6156 build-depends:
6257 servant >= 0.14.1 && <0.15
@@ -78,7 +73,6 @@ library
7873 hs-source-dirs: src
7974 default-language: Haskell2010
8075 ghc-options: -Wall
81− include-dirs: include
8276
8377test-suite spec
8478 type: exitcode-stdio-1.0
servant-client-core/src/Servant/Client/Core/Internal/Generic.hs+1−4
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE DataKinds #-}
32{-# LANGUAGE DefaultSignatures #-}
43{-# LANGUAGE FlexibleContexts #-}
@@ -8,8 +7,6 @@
87{-# LANGUAGE TypeOperators #-}
98{-# LANGUAGE UndecidableInstances #-}
109
11−#include "overlapping-compat.h"
12−
1310module Servant.Client.Core.Internal.Generic where
1411
1512import Generics.SOP
@@ -142,7 +139,7 @@ instance (GClientList b acc, GClientList a (ClientList b acc))
142139 => GClientList (a :<|> b) acc where
143140 gClientList (a :<|> b) acc = gClientList a (gClientList b acc)
144141
145−instance OVERLAPPABLE_ (ClientList client acc ~ (client ': acc))
142+instance {-# OVERLAPPABLE #-} (ClientList client acc ~ (client ': acc))
146143 => GClientList client acc where
147144 gClientList c acc = I c :* acc
148145
servant-client-core/src/Servant/Client/Core/Internal/HasClient.hs+5−7
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE DataKinds #-}
32{-# LANGUAGE FlexibleContexts #-}
43{-# LANGUAGE FlexibleInstances #-}
@@ -12,7 +11,6 @@
1211{-# LANGUAGE TypeOperators #-}
1312{-# LANGUAGE UndecidableInstances #-}
1413
15−#include "overlapping-compat.h"
1614module Servant.Client.Core.Internal.HasClient where
1715
1816import Prelude ()
@@ -209,7 +207,7 @@ instance (KnownSymbol capture, ToHttpApiData a, HasClient m sublayout)
209207 hoistClientMonad pm _ f cl = \as ->
210208 hoistClientMonad pm (Proxy :: Proxy sublayout) f (cl as)
211209
212−instance OVERLAPPABLE_
210+instance {-# OVERLAPPABLE #-}
213211 -- Note [Non-Empty Content Types]
214212 ( RunClient m, MimeUnrender ct a, ReflectMethod method, cts' ~ (ct ': cts)
215213 ) => HasClient m (Verb method status cts' a) where
@@ -226,7 +224,7 @@ instance OVERLAPPABLE_
226224
227225 hoistClientMonad _ _ f ma = f ma
228226
229−instance OVERLAPPING_
227+instance {-# OVERLAPPING #-}
230228 ( RunClient m, ReflectMethod method
231229 ) => HasClient m (Verb method status cts NoContent) where
232230 type Client m (Verb method status cts NoContent)
@@ -238,7 +236,7 @@ instance OVERLAPPING_
238236
239237 hoistClientMonad _ _ f ma = f ma
240238
241−instance OVERLAPPING_
239+instance {-# OVERLAPPING #-}
242240 -- Note [Non-Empty Content Types]
243241 ( RunClient m, MimeUnrender ct a, BuildHeadersTo ls
244242 , ReflectMethod method, cts' ~ (ct ': cts)
@@ -261,7 +259,7 @@ instance OVERLAPPING_
261259
262260 hoistClientMonad _ _ f ma = f ma
263261
264−instance OVERLAPPING_
262+instance {-# OVERLAPPING #-}
265263 ( RunClient m, BuildHeadersTo ls, ReflectMethod method
266264 ) => HasClient m (Verb method status cts (Headers ls NoContent)) where
267265 type Client m (Verb method status cts (Headers ls NoContent))
@@ -275,7 +273,7 @@ instance OVERLAPPING_
275273
276274 hoistClientMonad _ _ f ma = f ma
277275
278−instance OVERLAPPABLE_
276+instance {-# OVERLAPPABLE #-}
279277 ( RunClient m, MonadIO m, MimeUnrender ct a, ReflectMethod method,
280278 FramingUnrender framing a, FromResultStream a b
281279 ) => HasClient m (Stream method status framing ct b) where
servant-client/include/overlapping-compat.hdeleted−8
@@ -1,8 +0,0 @@
1−#if __GLASGOW_HASKELL__ >= 710
2−#define OVERLAPPABLE_ {-# OVERLAPPABLE #-}
3−#define OVERLAPPING_ {-# OVERLAPPING #-}
4−#else
5−{-# LANGUAGE OverlappingInstances #-}
6−#define OVERLAPPABLE_
7−#define OVERLAPPING_
8−#endif
servant-client/servant-client.cabal+1−12
@@ -23,7 +23,6 @@ tested-with:
2323homepage: http://haskell-servant.readthedocs.org/
2424Bug-reports: http://github.com/haskell-servant/servant/issues
2525extra-source-files:
26− include/*.h
2726 CHANGELOG.md
2827 README.md
2928source-repository head
@@ -48,9 +47,6 @@ library
4847 , time >= 1.4.2 && < 1.9
4948 , transformers >= 0.3.0.0 && < 0.6
5049
51− if !impl(ghc >= 8.0)
52− build-depends: semigroups >=0.18.4 && <0.19
53−
5450 -- Servant dependencies
5551 build-depends:
5652 servant-client-core == 0.14.*
@@ -71,10 +67,7 @@ library
7167
7268 hs-source-dirs: src
7369 default-language: Haskell2010
74− ghc-options: -Wall
75− if impl(ghc >= 8.0)
76− ghc-options: -Wno-redundant-constraints
77− include-dirs: include
70+ ghc-options: -Wall -Wno-redundant-constraints
7871
7972test-suite spec
8073 type: exitcode-stdio-1.0
@@ -104,10 +97,6 @@ test-suite spec
10497 , wai
10598 , warp
10699
107− if !impl(ghc >= 8.0)
108− build-depends:
109− semigroups
110−
111100 -- Additonal dependencies
112101 build-depends:
113102 generics-sop >= 0.3.2.0 && < 0.4
servant-client/test/Servant/ClientSpec.hs−5
@@ -15,15 +15,10 @@
1515{-# LANGUAGE TypeFamilies #-}
1616{-# LANGUAGE TypeOperators #-}
1717{-# LANGUAGE UndecidableInstances #-}
18−#if __GLASGOW_HASKELL__ >= 800
1918{-# OPTIONS_GHC -freduction-depth=100 #-}
20−#else
21−{-# OPTIONS_GHC -fcontext-stack=100 #-}
22−#endif
2319{-# OPTIONS_GHC -fno-warn-orphans #-}
2420{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
2521
26−#include "overlapping-compat.h"
2722module Servant.ClientSpec (spec, Person(..), startWaiApp, endWaiApp) where
2823
2924import Prelude ()
servant-client/test/Servant/StreamSpec.hs−5
@@ -15,15 +15,10 @@
1515{-# LANGUAGE TypeFamilies #-}
1616{-# LANGUAGE TypeOperators #-}
1717{-# LANGUAGE UndecidableInstances #-}
18−#if __GLASGOW_HASKELL__ >= 800
1918{-# OPTIONS_GHC -freduction-depth=100 #-}
20−#else
21−{-# OPTIONS_GHC -fcontext-stack=100 #-}
22−#endif
2319{-# OPTIONS_GHC -fno-warn-orphans #-}
2420{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
2521
26−#include "overlapping-compat.h"
2722module Servant.StreamSpec (spec) where
2823
2924import Control.Monad
servant-docs/include/overlapping-compat.hdeleted−8
@@ -1,8 +0,0 @@
1−#if __GLASGOW_HASKELL__ >= 710
2−#define OVERLAPPABLE_ {-# OVERLAPPABLE #-}
3−#define OVERLAPPING_ {-# OVERLAPPING #-}
4−#else
5−{-# LANGUAGE OverlappingInstances #-}
6−#define OVERLAPPABLE_
7−#define OVERLAPPING_
8−#endif
servant-docs/servant-docs.cabal+1−9
@@ -23,7 +23,6 @@ tested-with:
2323homepage: http://haskell-servant.readthedocs.org/
2424Bug-reports: http://github.com/haskell-servant/servant/issues
2525extra-source-files:
26− include/*.h
2726 CHANGELOG.md
2827 README.md
2928source-repository head
@@ -45,10 +44,6 @@ library
4544 , bytestring >= 0.10.4.0 && < 0.11
4645 , text >= 1.2.3.0 && < 1.3
4746
48− if !impl(ghc >= 8.0)
49− build-depends:
50− semigroups >=0.18.3 && <0.19
51−
5247 -- Servant dependencies
5348 build-depends:
5449 servant == 0.13.* || ==0.14.*
@@ -70,10 +65,7 @@ library
7065
7166 hs-source-dirs: src
7267 default-language: Haskell2010
73− ghc-options: -Wall
74− if impl(ghc >= 8.0)
75− ghc-options: -Wno-redundant-constraints
76− include-dirs: include
68+ ghc-options: -Wall -Wno-redundant-constraints
7769
7870executable greet-docs
7971 main-is: greet.hs
servant-docs/src/Servant/Docs/Internal.hs+4−6
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE ConstraintKinds #-}
32{-# LANGUAGE DataKinds #-}
43{-# LANGUAGE DefaultSignatures #-}
@@ -17,7 +16,6 @@
1716{-# LANGUAGE TypeOperators #-}
1817{-# LANGUAGE UndecidableInstances #-}
1918
20−#include "overlapping-compat.h"
2119module Servant.Docs.Internal where
2220
2321import Prelude ()
@@ -788,7 +786,7 @@ markdownWith RenderingOptions{..} api = unlines $
788786
789787-- | The generated docs for @a ':<|>' b@ just appends the docs
790788-- for @a@ with the docs for @b@.
791−instance OVERLAPPABLE_
789+instance {-# OVERLAPPABLE #-}
792790 (HasDocs a, HasDocs b)
793791 => HasDocs (a :<|> b) where
794792
@@ -836,7 +834,7 @@ instance (KnownSymbol sym, ToCapture (CaptureAll sym a), HasDocs sublayout)
836834 symP = Proxy :: Proxy sym
837835
838836
839−instance OVERLAPPABLE_
837+instance {-# OVERLAPPABLE #-}
840838 (ToSample a, AllMimeRender (ct ': cts) a, KnownNat status
841839 , ReflectMethod method)
842840 => HasDocs (Verb method status (ct ': cts) a) where
@@ -855,7 +853,7 @@ instance OVERLAPPABLE_
855853-- | TODO: mention the endpoint is streaming, its framing strategy
856854--
857855-- Also there are no samples.
858−instance OVERLAPPABLE_
856+instance {-# OVERLAPPABLE #-}
859857 (MimeRender ct a, KnownNat status
860858 , ReflectMethod method)
861859 => HasDocs (Stream method status framing ct a) where
@@ -870,7 +868,7 @@ instance OVERLAPPABLE_
870868 status = fromInteger $ natVal (Proxy :: Proxy status)
871869 p = Proxy :: Proxy a
872870
873−instance OVERLAPPING_
871+instance {-# OVERLAPPING #-}
874872 (ToSample a, AllMimeRender (ct ': cts) a, KnownNat status
875873 , ReflectMethod method, AllHeaderSamples ls, GetHeaders (HList ls))
876874 => HasDocs (Verb method status (ct ': cts) (Headers ls a)) where
servant-docs/test/Servant/DocsSpec.hs−5
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE DataKinds #-}
32{-# LANGUAGE DeriveGeneric #-}
43{-# LANGUAGE FlexibleContexts #-}
@@ -8,11 +7,7 @@
87{-# LANGUAGE TypeOperators #-}
98{-# LANGUAGE TypeSynonymInstances #-}
109{-# OPTIONS_GHC -fno-warn-orphans #-}
11−#if __GLASGOW_HASKELL__ >= 800
1210{-# OPTIONS_GHC -freduction-depth=100 #-}
13−#else
14−{-# OPTIONS_GHC -fcontext-stack=100 #-}
15−#endif
1611
1712module Servant.DocsSpec where
1813
servant-foreign/include/overlapping-compat.hdeleted−8
@@ -1,8 +0,0 @@
1−#if __GLASGOW_HASKELL__ >= 710
2−#define OVERLAPPABLE_ {-# OVERLAPPABLE #-}
3−#define OVERLAPPING_ {-# OVERLAPPING #-}
4−#else
5−{-# LANGUAGE OverlappingInstances #-}
6−#define OVERLAPPABLE_
7−#define OVERLAPPING_
8−#endif
servant-foreign/servant-foreign.cabal+1−10
@@ -19,7 +19,6 @@ category: Servant, Web
1919build-type: Simple
2020cabal-version: >=1.10
2121extra-source-files:
22− include/*.h
2322 CHANGELOG.md
2423 README.md
2524bug-reports: http://github.com/haskell-servant/servant/issues
@@ -45,10 +44,6 @@ library
4544 base >= 4.7 && <4.12
4645 , text >= 1.2.3.0 && < 1.3
4746
48− if !impl(ghc >= 8.0)
49− build-depends:
50− semigroups >=0.18.3 && <0.19
51−
5247 -- Servant dependencies
5348 build-depends:
5449 servant == 0.13.* || ==0.14.*
@@ -62,16 +57,12 @@ library
6257
6358 hs-source-dirs: src
6459 default-language: Haskell2010
65− ghc-options: -Wall
66− if impl(ghc >= 8.0)
67− ghc-options: -Wno-redundant-constraints
68− include-dirs: include
60+ ghc-options: -Wall -Wno-redundant-constraints
6961
7062test-suite spec
7163 type: exitcode-stdio-1.0
7264 hs-source-dirs: test
7365 ghc-options: -Wall
74− include-dirs: include
7566 main-is: Spec.hs
7667 other-modules: Servant.ForeignSpec
7768
servant-foreign/src/Servant/Foreign/Internal.hs−3
@@ -12,9 +12,6 @@
1212{-# LANGUAGE TypeFamilies #-}
1313{-# LANGUAGE TypeOperators #-}
1414{-# LANGUAGE UndecidableInstances #-}
15−#if !MIN_VERSION_base(4,8,0)
16−{-# LANGUAGE NullaryTypeClasses #-}
17−#endif
1815
1916-- | Generalizes all the data needed to make code generation work with
2017-- arbitrary programming languages.
servant-foreign/test/Servant/ForeignSpec.hs+2−7
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE ConstraintKinds #-}
32{-# LANGUAGE DataKinds #-}
43{-# LANGUAGE FlexibleContexts #-}
@@ -9,10 +8,6 @@
98{-# LANGUAGE ScopedTypeVariables #-}
109{-# LANGUAGE TypeFamilies #-}
1110{-# LANGUAGE TypeOperators #-}
12−#if __GLASGOW_HASKELL__ < 709
13−{-# OPTIONS_GHC -fcontext-stack=41 #-}
14−#endif
15−#include "overlapping-compat.h"
1611
1712module Servant.ForeignSpec where
1813
@@ -59,10 +54,10 @@ instance HasForeignType LangX String Int where
5954instance HasForeignType LangX String Bool where
6055 typeFor _ _ _ = "boolX"
6156
62−instance OVERLAPPING_ HasForeignType LangX String String where
57+instance {-# OVERLAPPING #-} HasForeignType LangX String String where
6358 typeFor _ _ _ = "stringX"
6459
65−instance OVERLAPPABLE_ HasForeignType LangX String a => HasForeignType LangX String [a] where
60+instance {-# OVERLAPPABLE #-} HasForeignType LangX String a => HasForeignType LangX String [a] where
6661 typeFor lang ftype _ = "listX of " <> typeFor lang ftype (Proxy :: Proxy a)
6762
6863instance (HasForeignType LangX String a) => HasForeignType LangX String (Maybe a) where
servant-server/Setup.lhs → servant-server/Setup.hsrenamed+5−3
@@ -1,4 +1,3 @@
1−\begin{code}
21{-# LANGUAGE CPP #-}
32{-# OPTIONS_GHC -Wall #-}
43module Main (main) where
@@ -16,6 +15,11 @@ main = defaultMainWithDoctests "doctests"
1615#else
1716
1817#ifdef MIN_VERSION_Cabal
18+-- If the macro is defined, we have new cabal-install,
19+-- but for some reason we don't have cabal-doctest in package-db
20+--
21+-- Probably we are running cabal sdist, when otherwise using new-build
22+-- workflow
1923#warning You are configuring this package without cabal-doctest installed. \
2024 The doctests test-suite will not work as a result. \
2125 To fix this, install cabal-doctest before configuring.
@@ -27,5 +31,3 @@ main :: IO ()
2731main = defaultMain
2832
2933#endif
30−
31−\end{code}
servant-server/include/overlapping-compat.hdeleted−8
@@ -1,8 +0,0 @@
1−#if __GLASGOW_HASKELL__ >= 710
2−#define OVERLAPPABLE_ {-# OVERLAPPABLE #-}
3−#define OVERLAPPING_ {-# OVERLAPPING #-}
4−#else
5−{-# LANGUAGE OverlappingInstances #-}
6−#define OVERLAPPABLE_
7−#define OVERLAPPING_
8−#endif
servant-server/servant-server.cabal+1−6
@@ -26,7 +26,6 @@ tested-with:
2626 GHC==8.2.2
2727 GHC==8.4.3
2828extra-source-files:
29− include/*.h
3029 CHANGELOG.md
3130 README.md
3231
@@ -103,10 +102,7 @@ library
103102
104103 hs-source-dirs: src
105104 default-language: Haskell2010
106− ghc-options: -Wall
107− if impl(ghc >= 8.0)
108− ghc-options: -Wno-redundant-constraints
109− include-dirs: include
105+ ghc-options: -Wall -Wno-redundant-constraints
110106
111107executable greet
112108 main-is: greet.hs
@@ -187,4 +183,3 @@ test-suite doctests
187183 ghc-options: -Wall -threaded
188184 if impl(ghc >= 8.2)
189185 x-doctest-options: -fdiagnostics-color=never
190− include-dirs: include
servant-server/src/Servant/Server/Internal.hs+4−6
@@ -18,8 +18,6 @@
1818#define HAS_TYPE_ERROR
1919#endif
2020
21−#include "overlapping-compat.h"
22−
2321module Servant.Server.Internal
2422 ( module Servant.Server.Internal
2523 , module Servant.Server.Internal.BasicAuth
@@ -256,7 +254,7 @@ methodRouter splitHeaders method proxy status action = leafRouter route'
256254 let bdy = if allowedMethodHead method request then "" else body
257255 in Route $ responseLBS status ((hContentType, cs contentT) : headers) bdy
258256
259−instance OVERLAPPABLE_
257+instance {-# OVERLAPPABLE #-}
260258 ( AllCTRender ctypes a, ReflectMethod method, KnownNat status
261259 ) => HasServer (Verb method status ctypes a) context where
262260
@@ -267,7 +265,7 @@ instance OVERLAPPABLE_
267265 where method = reflectMethod (Proxy :: Proxy method)
268266 status = toEnum . fromInteger $ natVal (Proxy :: Proxy status)
269267
270−instance OVERLAPPING_
268+instance {-# OVERLAPPING #-}
271269 ( AllCTRender ctypes a, ReflectMethod method, KnownNat status
272270 , GetHeaders (Headers h a)
273271 ) => HasServer (Verb method status ctypes (Headers h a)) context where
@@ -280,7 +278,7 @@ instance OVERLAPPING_
280278 status = toEnum . fromInteger $ natVal (Proxy :: Proxy status)
281279
282280
283−instance OVERLAPPABLE_
281+instance {-# OVERLAPPABLE #-}
284282 ( MimeRender ctype a, ReflectMethod method, KnownNat status,
285283 FramingRender framing ctype, ToStreamGenerator b a
286284 ) => HasServer (Stream method status framing ctype b) context where
@@ -292,7 +290,7 @@ instance OVERLAPPABLE_
292290 where method = reflectMethod (Proxy :: Proxy method)
293291 status = toEnum . fromInteger $ natVal (Proxy :: Proxy status)
294292
295−instance OVERLAPPING_
293+instance {-# OVERLAPPING #-}
296294 ( MimeRender ctype a, ReflectMethod method, KnownNat status,
297295 FramingRender framing ctype, ToStreamGenerator b a,
298296 GetHeaders (Headers h b)
servant-server/src/Servant/Server/Internal/Context.hs+2−5
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE DataKinds #-}
32{-# LANGUAGE FlexibleContexts #-}
43{-# LANGUAGE FlexibleInstances #-}
@@ -8,8 +7,6 @@
87{-# LANGUAGE ScopedTypeVariables #-}
98{-# LANGUAGE TypeOperators #-}
109
11−#include "overlapping-compat.h"
12−
1310module Servant.Server.Internal.Context where
1411
1512import Data.Proxy
@@ -64,11 +61,11 @@ instance (Eq a, Eq (Context as)) => Eq (Context (a ': as)) where
6461class HasContextEntry (context :: [*]) (val :: *) where
6562 getContextEntry :: Context context -> val
6663
67−instance OVERLAPPABLE_
64+instance {-# OVERLAPPABLE #-}
6865 HasContextEntry xs val => HasContextEntry (notIt ': xs) val where
6966 getContextEntry (_ :. xs) = getContextEntry xs
7067
71−instance OVERLAPPING_
68+instance {-# OVERLAPPING #-}
7269 HasContextEntry (val ': xs) val where
7370 getContextEntry (x :. _) = x
7471
servant-server/src/Servant/Server/StaticFiles.hs+1−10
@@ -24,10 +24,6 @@ import Servant.Server
2424 (ServerT, Tagged (..))
2525import System.FilePath
2626 (addTrailingPathSeparator)
27−#if !MIN_VERSION_wai_app_static(3,1,0)
28−import Filesystem.Path.CurrentOS
29− (decodeString)
30−#endif
3127import WaiAppStatic.Storage.Filesystem
3228 (ETagLookup)
3329
@@ -84,9 +80,4 @@ serveDirectory = serveDirectoryFileServer
8480{-# DEPRECATED serveDirectory "Use serveDirectoryFileServer instead" #-}
8581
8682fixPath :: FilePath -> FilePath
87−fixPath =
88−#if MIN_VERSION_wai_app_static(3,1,0)
89− addTrailingPathSeparator
90−#else
91− decodeString . addTrailingPathSeparator
92−#endif
83+fixPath = addTrailingPathSeparator
servant-server/test/Servant/ServerSpec.hs−5
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE DataKinds #-}
32{-# LANGUAGE DeriveGeneric #-}
43{-# LANGUAGE FlexibleContexts #-}
@@ -9,11 +8,7 @@
98{-# LANGUAGE TypeFamilies #-}
109{-# LANGUAGE TypeOperators #-}
1110{-# LANGUAGE TypeSynonymInstances #-}
12−#if __GLASGOW_HASKELL__ >= 800
1311{-# OPTIONS_GHC -freduction-depth=100 #-}
14−#else
15−{-# OPTIONS_GHC -fcontext-stack=100 #-}
16−#endif
1712
1813module Servant.ServerSpec where
1914
servant/Setup.lhs → servant/Setup.hsrenamed+5−3
@@ -1,4 +1,3 @@
1−\begin{code}
21{-# LANGUAGE CPP #-}
32{-# OPTIONS_GHC -Wall #-}
43module Main (main) where
@@ -16,6 +15,11 @@ main = defaultMainWithDoctests "doctests"
1615#else
1716
1817#ifdef MIN_VERSION_Cabal
18+-- If the macro is defined, we have new cabal-install,
19+-- but for some reason we don't have cabal-doctest in package-db
20+--
21+-- Probably we are running cabal sdist, when otherwise using new-build
22+-- workflow
1923#warning You are configuring this package without cabal-doctest installed. \
2024 The doctests test-suite will not work as a result. \
2125 To fix this, install cabal-doctest before configuring.
@@ -27,5 +31,3 @@ main :: IO ()
2731main = defaultMain
2832
2933#endif
30−
31−\end{code}
servant/include/overlapping-compat.hdeleted−8
@@ -1,8 +0,0 @@
1−#if __GLASGOW_HASKELL__ >= 710
2−#define OVERLAPPABLE_ {-# OVERLAPPABLE #-}
3−#define OVERLAPPING_ {-# OVERLAPPING #-}
4−#else
5−{-# LANGUAGE OverlappingInstances #-}
6−#define OVERLAPPABLE_
7−#define OVERLAPPING_
8−#endif
servant/servant.cabal+1−10
@@ -22,7 +22,6 @@ tested-with:
2222 GHC==8.2.2
2323 GHC==8.4.3
2424extra-source-files:
25− include/*.h
2625 CHANGELOG.md
2726source-repository head
2827 type: git
@@ -120,10 +119,7 @@ library
120119 , TypeOperators
121120 , TypeSynonymInstances
122121 , UndecidableInstances
123− ghc-options: -Wall
124− if impl(ghc >= 8.0)
125− ghc-options: -Wno-redundant-constraints
126− include-dirs: include
122+ ghc-options: -Wall -Wno-redundant-constraints
127123
128124test-suite spec
129125 type: exitcode-stdio-1.0
@@ -146,10 +142,6 @@ test-suite spec
146142 , string-conversions
147143 , text
148144
149− if !impl(ghc >= 8.0)
150− build-depends:
151− semigroups
152−
153145 -- Additonal dependencies
154146 build-depends:
155147 aeson-compat >= 0.3.8 && < 0.4
@@ -177,6 +169,5 @@ test-suite doctests
177169 ghc-options: -Wall -threaded
178170 if impl(ghc >= 8.2)
179171 x-doctest-options: -fdiagnostics-color=never
180− include-dirs: include
181172 x-doctest-source-dirs: test
182173 x-doctest-modules: Servant.LinksSpec
servant/src/Servant/API/ContentTypes.hs+8−16
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE ConstraintKinds #-}
32{-# LANGUAGE DataKinds #-}
43{-# LANGUAGE DeriveDataTypeable #-}
@@ -14,8 +13,6 @@
1413{-# LANGUAGE UndecidableInstances #-}
1514{-# OPTIONS_HADDOCK not-home #-}
1615
17−#include "overlapping-compat.h"
18−
1916-- | A collection of basic Content-Types (also known as Internet Media
2017-- Types, or MIME types). Additionally, this module provides classes that
2118-- encapsulate how to serialize or deserialize values to or from
@@ -98,16 +95,13 @@ import qualified Data.Text.Lazy.Encoding as TextL
9895import Data.Typeable
9996import GHC.Generics
10097 (Generic)
98+import qualified GHC.TypeLits as TL
10199import qualified Network.HTTP.Media as M
102100import Prelude ()
103101import Prelude.Compat
104102import Web.FormUrlEncoded
105103 (FromForm, ToForm, urlDecodeAsForm, urlEncodeAsForm)
106104
107−#if MIN_VERSION_base(4,9,0)
108−import qualified GHC.TypeLits as TL
109−#endif
110−
111105-- * Provided content types
112106data JSON deriving Typeable
113107data PlainText deriving Typeable
@@ -185,18 +179,16 @@ class (AllMime list) => AllCTRender (list :: [*]) a where
185179 -- mimetype).
186180 handleAcceptH :: Proxy list -> AcceptHeader -> a -> Maybe (ByteString, ByteString)
187181
188−instance OVERLAPPABLE_
182+instance {-# OVERLAPPABLE #-}
189183 (Accept ct, AllMime cts, AllMimeRender (ct ': cts) a) => AllCTRender (ct ': cts) a where
190184 handleAcceptH _ (AcceptHeader accept) val = M.mapAcceptMedia lkup accept
191185 where pctyps = Proxy :: Proxy (ct ': cts)
192186 amrs = allMimeRender pctyps val
193187 lkup = fmap (\(a,b) -> (a, (fromStrict $ M.renderHeader a, b))) amrs
194188
195−#if MIN_VERSION_base(4,9,0)
196189instance TL.TypeError ('TL.Text "No instance for (), use NoContent instead.")
197190 => AllCTRender '[] () where
198191 handleAcceptH _ _ _ = error "unreachable"
199−#endif
200192
201193--------------------------------------------------------------------------
202194-- * Unrender
@@ -277,13 +269,13 @@ class (AllMime list) => AllMimeRender (list :: [*]) a where
277269 -> a -- value to serialize
278270 -> [(M.MediaType, ByteString)] -- content-types/response pairs
279271
280−instance OVERLAPPABLE_ ( MimeRender ctyp a ) => AllMimeRender '[ctyp] a where
272+instance {-# OVERLAPPABLE #-} ( MimeRender ctyp a ) => AllMimeRender '[ctyp] a where
281273 allMimeRender _ a = map (, bs) $ NE.toList $ contentTypes pctyp
282274 where
283275 bs = mimeRender pctyp a
284276 pctyp = Proxy :: Proxy ctyp
285277
286−instance OVERLAPPABLE_
278+instance {-# OVERLAPPABLE #-}
287279 ( MimeRender ctyp a
288280 , AllMimeRender (ctyp' ': ctyps) a
289281 ) => AllMimeRender (ctyp ': ctyp' ': ctyps) a where
@@ -299,12 +291,12 @@ instance OVERLAPPABLE_
299291-- Ideally we would like to declare a 'MimeRender a NoContent' instance, and
300292-- then this would be taken care of. However there is no more specific instance
301293-- between that and 'MimeRender JSON a', so we do this instead
302−instance OVERLAPPING_ ( Accept ctyp ) => AllMimeRender '[ctyp] NoContent where
294+instance {-# OVERLAPPING #-} ( Accept ctyp ) => AllMimeRender '[ctyp] NoContent where
303295 allMimeRender _ _ = map (, "") $ NE.toList $ contentTypes pctyp
304296 where
305297 pctyp = Proxy :: Proxy ctyp
306298
307−instance OVERLAPPING_
299+instance {-# OVERLAPPING #-}
308300 ( AllMime (ctyp ': ctyp' ': ctyps)
309301 ) => AllMimeRender (ctyp ': ctyp' ': ctyps) NoContent where
310302 allMimeRender p _ = zip (allMime p) (repeat "")
@@ -334,14 +326,14 @@ instance ( MimeUnrender ctyp a
334326-- * MimeRender Instances
335327
336328-- | `encode`
337−instance OVERLAPPABLE_
329+instance {-# OVERLAPPABLE #-}
338330 ToJSON a => MimeRender JSON a where
339331 mimeRender _ = encode
340332
341333-- | @urlEncodeAsForm@
342334-- Note that the @mimeUnrender p (mimeRender p x) == Right x@ law only
343335-- holds if every element of x is non-null (i.e., not @("", "")@)
344−instance OVERLAPPABLE_
336+instance {-# OVERLAPPABLE #-}
345337 ToForm a => MimeRender FormUrlEncoded a where
346338 mimeRender _ = urlEncodeAsForm
347339
servant/src/Servant/API/ResponseHeaders.hs+4−6
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE DataKinds #-}
32{-# LANGUAGE DeriveDataTypeable #-}
43{-# LANGUAGE DeriveFunctor #-}
@@ -15,7 +14,6 @@
1514{-# LANGUAGE UndecidableInstances #-}
1615{-# OPTIONS_HADDOCK not-home #-}
1716
18−#include "overlapping-compat.h"
1917-- | This module provides facilities for adding headers to a response.
2018--
2119-- >>> let headerVal = addHeader "some-url" 5 :: Headers '[Header "Location" String] Int
@@ -80,10 +78,10 @@ class BuildHeadersTo hs where
8078 -- the values are interspersed with commas before deserialization (see
8179 -- <http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 RFC2616 Sec 4.2>)
8280
83−instance OVERLAPPING_ BuildHeadersTo '[] where
81+instance {-# OVERLAPPING #-} BuildHeadersTo '[] where
8482 buildHeadersTo _ = HNil
8583
86−instance OVERLAPPABLE_ ( FromHttpApiData v, BuildHeadersTo xs, KnownSymbol h )
84+instance {-# OVERLAPPABLE #-} ( FromHttpApiData v, BuildHeadersTo xs, KnownSymbol h )
8785 => BuildHeadersTo (Header h v ': xs) where
8886 buildHeadersTo headers =
8987 let wantedHeader = CI.mk . pack $ symbolVal (Proxy :: Proxy h)
@@ -144,11 +142,11 @@ class AddHeader h v orig new
144142 addOptionalHeader :: ResponseHeader h v -> orig -> new -- ^ N.B.: The same header can't be added multiple times
145143
146144
147−instance OVERLAPPING_ ( KnownSymbol h, ToHttpApiData v )
145+instance {-# OVERLAPPING #-} ( KnownSymbol h, ToHttpApiData v )
148146 => AddHeader h v (Headers (fst ': rest) a) (Headers (Header h v ': fst ': rest) a) where
149147 addOptionalHeader hdr (Headers resp heads) = Headers resp (HCons hdr heads)
150148
151−instance OVERLAPPABLE_ ( KnownSymbol h, ToHttpApiData v
149+instance {-# OVERLAPPABLE #-} ( KnownSymbol h, ToHttpApiData v
152150 , new ~ (Headers '[Header h v] a) )
153151 => AddHeader h v a new where
154152 addOptionalHeader hdr resp = Headers resp (HCons hdr HNil)
servant/src/Servant/API/TypeLevel.hs−15
@@ -41,9 +41,6 @@ module Servant.API.TypeLevel (
4141 -- ** Logic
4242 Or,
4343 And,
44− -- * Custom type errors
45− -- | Before @base-4.9.0.0@ we use non-exported 'ElemNotFoundIn' class,
46− -- which cannot be instantiated.
4744 ) where
4845
4946
@@ -63,10 +60,8 @@ import Servant.API.Sub
6360 (type (:>))
6461import Servant.API.Verbs
6562 (Verb)
66−#if MIN_VERSION_base(4,9,0)
6763import GHC.TypeLits
6864 (ErrorMessage (..), TypeError)
69−#endif
7065
7166
7267
@@ -222,14 +217,10 @@ type Elem e es = ElemGo e es es
222217type family ElemGo e es orig :: Constraint where
223218 ElemGo x (x ': xs) orig = ()
224219 ElemGo y (x ': xs) orig = ElemGo y xs orig
225−#if MIN_VERSION_base(4,9,0)
226220 -- Note [Custom Errors]
227221 ElemGo x '[] orig = TypeError ('ShowType x
228222 ':<>: 'Text " expected in list "
229223 ':<>: 'ShowType orig)
230−#else
231− ElemGo x '[] orig = ElemNotFoundIn x orig
232−#endif
233224
234225-- ** Logic
235226
@@ -244,12 +235,6 @@ type family Or (a :: Constraint) (b :: Constraint) :: Constraint where
244235type family And (a :: Constraint) (b :: Constraint) :: Constraint where
245236 And () () = ()
246237
247−-- * Custom type errors
248−
249−#if !MIN_VERSION_base(4,9,0)
250−class ElemNotFoundIn val list
251−#endif
252−
253238{- Note [Custom Errors]
254239~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
255240We might try to factor these our more cleanly, but the type synonyms and type
servant/test/Servant/API/ContentTypesSpec.hs−3
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE DataKinds #-}
32{-# LANGUAGE DeriveGeneric #-}
43{-# LANGUAGE MultiParamTypeClasses #-}
@@ -195,7 +194,6 @@ spec = describe "Servant.API.ContentTypes" $ do
195194 handleCTypeH (Proxy :: Proxy '[JSONorText]) "image/jpeg"
196195 "foobar" `shouldBe` (Nothing :: Maybe (Either String Int))
197196
198−#if MIN_VERSION_aeson(0,9,0)
199197 -- aeson >= 0.9 decodes top-level strings
200198 describe "eitherDecodeLenient" $ do
201199
@@ -204,7 +202,6 @@ spec = describe "Servant.API.ContentTypes" $ do
204202 -- The Left messages differ, so convert to Maybe
205203 property $ \x -> toMaybe (eitherDecodeLenient x)
206204 `shouldBe` (decode x :: Maybe String)
207−#endif
208205
209206
210207data SomeData = SomeData { record1 :: String, record2 :: Int }
servant/test/Servant/LinksSpec.hs−4
@@ -1,12 +1,8 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE ConstraintKinds #-}
32{-# LANGUAGE DataKinds #-}
43{-# LANGUAGE PolyKinds #-}
54{-# LANGUAGE ScopedTypeVariables #-}
65{-# LANGUAGE TypeOperators #-}
7−#if __GLASGOW_HASKELL__ < 709
8−{-# OPTIONS_GHC -fcontext-stack=41 #-}
9−#endif
106module Servant.LinksSpec where
117
128import Data.Proxy