git.iko.soy/typeable/servant
on master help sign in
Merge pull request #1009 from phadej/cleanup-pre-ghc-8.0
99e535bOleg Grenrus
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
15category: Web
15category: Web
16build-type: Simple
16build-type: Simple
17extra-source-files:
17extra-source-files:
18− include/*.h
19 CHANGELOG.md
18 CHANGELOG.md
20 README.md
19 README.md
21tested-with:
20tested-with:
@@ -53,10 +52,6 @@ library
53 , text >= 1.2.3.0 && < 1.3
52 , text >= 1.2.3.0 && < 1.3
54 , transformers >= 0.3.0.0 && < 0.6
53 , transformers >= 0.3.0.0 && < 0.6
55
54
56− if !impl(ghc >= 8.0)
57− build-depends:
58− semigroups >=0.18.4 && <0.19
59−
60 -- Servant dependencies
55 -- Servant dependencies
61 build-depends:
56 build-depends:
62 servant >= 0.14.1 && <0.15
57 servant >= 0.14.1 && <0.15
@@ -78,7 +73,6 @@ library
78 hs-source-dirs: src
73 hs-source-dirs: src
79 default-language: Haskell2010
74 default-language: Haskell2010
80 ghc-options: -Wall
75 ghc-options: -Wall
81− include-dirs: include
82
76
83test-suite spec
77test-suite spec
84 type: exitcode-stdio-1.0
78 type: exitcode-stdio-1.0
servant-client-core/src/Servant/Client/Core/Internal/Generic.hs+1−4
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
2{-# LANGUAGE DataKinds #-}
1{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE DefaultSignatures #-}
2{-# LANGUAGE DefaultSignatures #-}
4{-# LANGUAGE FlexibleContexts #-}
3{-# LANGUAGE FlexibleContexts #-}
@@ -8,8 +7,6 @@
8{-# LANGUAGE TypeOperators #-}
7{-# LANGUAGE TypeOperators #-}
9{-# LANGUAGE UndecidableInstances #-}
8{-# LANGUAGE UndecidableInstances #-}
10
9
11−#include "overlapping-compat.h"
12−
13module Servant.Client.Core.Internal.Generic where
10module Servant.Client.Core.Internal.Generic where
14
11
15import Generics.SOP
12import Generics.SOP
@@ -142,7 +139,7 @@ instance (GClientList b acc, GClientList a (ClientList b acc))
142 => GClientList (a :<|> b) acc where
139 => GClientList (a :<|> b) acc where
143 gClientList (a :<|> b) acc = gClientList a (gClientList b acc)
140 gClientList (a :<|> b) acc = gClientList a (gClientList b acc)
144
141
145−instance OVERLAPPABLE_ (ClientList client acc ~ (client ': acc))
142+instance {-# OVERLAPPABLE #-} (ClientList client acc ~ (client ': acc))
146 => GClientList client acc where
143 => GClientList client acc where
147 gClientList c acc = I c :* acc
144 gClientList c acc = I c :* acc
148
145
servant-client-core/src/Servant/Client/Core/Internal/HasClient.hs+5−7
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
2{-# LANGUAGE DataKinds #-}
1{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE FlexibleContexts #-}
2{-# LANGUAGE FlexibleContexts #-}
4{-# LANGUAGE FlexibleInstances #-}
3{-# LANGUAGE FlexibleInstances #-}
@@ -12,7 +11,6 @@
12{-# LANGUAGE TypeOperators #-}
11{-# LANGUAGE TypeOperators #-}
13{-# LANGUAGE UndecidableInstances #-}
12{-# LANGUAGE UndecidableInstances #-}
14
13
15−#include "overlapping-compat.h"
16module Servant.Client.Core.Internal.HasClient where
14module Servant.Client.Core.Internal.HasClient where
17
15
18import Prelude ()
16import Prelude ()
@@ -209,7 +207,7 @@ instance (KnownSymbol capture, ToHttpApiData a, HasClient m sublayout)
209 hoistClientMonad pm _ f cl = \as ->
207 hoistClientMonad pm _ f cl = \as ->
210 hoistClientMonad pm (Proxy :: Proxy sublayout) f (cl as)
208 hoistClientMonad pm (Proxy :: Proxy sublayout) f (cl as)
211
209
212−instance OVERLAPPABLE_
210+instance {-# OVERLAPPABLE #-}
213 -- Note [Non-Empty Content Types]
211 -- Note [Non-Empty Content Types]
214 ( RunClient m, MimeUnrender ct a, ReflectMethod method, cts' ~ (ct ': cts)
212 ( RunClient m, MimeUnrender ct a, ReflectMethod method, cts' ~ (ct ': cts)
215 ) => HasClient m (Verb method status cts' a) where
213 ) => HasClient m (Verb method status cts' a) where
@@ -226,7 +224,7 @@ instance OVERLAPPABLE_
226
224
227 hoistClientMonad _ _ f ma = f ma
225 hoistClientMonad _ _ f ma = f ma
228
226
229−instance OVERLAPPING_
227+instance {-# OVERLAPPING #-}
230 ( RunClient m, ReflectMethod method
228 ( RunClient m, ReflectMethod method
231 ) => HasClient m (Verb method status cts NoContent) where
229 ) => HasClient m (Verb method status cts NoContent) where
232 type Client m (Verb method status cts NoContent)
230 type Client m (Verb method status cts NoContent)
@@ -238,7 +236,7 @@ instance OVERLAPPING_
238
236
239 hoistClientMonad _ _ f ma = f ma
237 hoistClientMonad _ _ f ma = f ma
240
238
241−instance OVERLAPPING_
239+instance {-# OVERLAPPING #-}
242 -- Note [Non-Empty Content Types]
240 -- Note [Non-Empty Content Types]
243 ( RunClient m, MimeUnrender ct a, BuildHeadersTo ls
241 ( RunClient m, MimeUnrender ct a, BuildHeadersTo ls
244 , ReflectMethod method, cts' ~ (ct ': cts)
242 , ReflectMethod method, cts' ~ (ct ': cts)
@@ -261,7 +259,7 @@ instance OVERLAPPING_
261
259
262 hoistClientMonad _ _ f ma = f ma
260 hoistClientMonad _ _ f ma = f ma
263
261
264−instance OVERLAPPING_
262+instance {-# OVERLAPPING #-}
265 ( RunClient m, BuildHeadersTo ls, ReflectMethod method
263 ( RunClient m, BuildHeadersTo ls, ReflectMethod method
266 ) => HasClient m (Verb method status cts (Headers ls NoContent)) where
264 ) => HasClient m (Verb method status cts (Headers ls NoContent)) where
267 type Client m (Verb method status cts (Headers ls NoContent))
265 type Client m (Verb method status cts (Headers ls NoContent))
@@ -275,7 +273,7 @@ instance OVERLAPPING_
275
273
276 hoistClientMonad _ _ f ma = f ma
274 hoistClientMonad _ _ f ma = f ma
277
275
278−instance OVERLAPPABLE_
276+instance {-# OVERLAPPABLE #-}
279 ( RunClient m, MonadIO m, MimeUnrender ct a, ReflectMethod method,
277 ( RunClient m, MonadIO m, MimeUnrender ct a, ReflectMethod method,
280 FramingUnrender framing a, FromResultStream a b
278 FramingUnrender framing a, FromResultStream a b
281 ) => HasClient m (Stream method status framing ct b) where
279 ) => 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:
23homepage: http://haskell-servant.readthedocs.org/
23homepage: http://haskell-servant.readthedocs.org/
24Bug-reports: http://github.com/haskell-servant/servant/issues
24Bug-reports: http://github.com/haskell-servant/servant/issues
25extra-source-files:
25extra-source-files:
26− include/*.h
27 CHANGELOG.md
26 CHANGELOG.md
28 README.md
27 README.md
29source-repository head
28source-repository head
@@ -48,9 +47,6 @@ library
48 , time >= 1.4.2 && < 1.9
47 , time >= 1.4.2 && < 1.9
49 , transformers >= 0.3.0.0 && < 0.6
48 , transformers >= 0.3.0.0 && < 0.6
50
49
51− if !impl(ghc >= 8.0)
52− build-depends: semigroups >=0.18.4 && <0.19
53−
54 -- Servant dependencies
50 -- Servant dependencies
55 build-depends:
51 build-depends:
56 servant-client-core == 0.14.*
52 servant-client-core == 0.14.*
@@ -71,10 +67,7 @@ library
71
67
72 hs-source-dirs: src
68 hs-source-dirs: src
73 default-language: Haskell2010
69 default-language: Haskell2010
74− ghc-options: -Wall
75− if impl(ghc >= 8.0)
76− ghc-options: -Wno-redundant-constraints
70+ ghc-options: -Wall -Wno-redundant-constraints
77− include-dirs: include
78
71
79test-suite spec
72test-suite spec
80 type: exitcode-stdio-1.0
73 type: exitcode-stdio-1.0
@@ -104,10 +97,6 @@ test-suite spec
104 , wai
97 , wai
105 , warp
98 , warp
106
99
107− if !impl(ghc >= 8.0)
108− build-depends:
109− semigroups
110−
111 -- Additonal dependencies
100 -- Additonal dependencies
112 build-depends:
101 build-depends:
113 generics-sop >= 0.3.2.0 && < 0.4
102 generics-sop >= 0.3.2.0 && < 0.4
servant-client/test/Servant/ClientSpec.hs−5
@@ -15,15 +15,10 @@
15{-# LANGUAGE TypeFamilies #-}
15{-# LANGUAGE TypeFamilies #-}
16{-# LANGUAGE TypeOperators #-}
16{-# LANGUAGE TypeOperators #-}
17{-# LANGUAGE UndecidableInstances #-}
17{-# LANGUAGE UndecidableInstances #-}
18−#if __GLASGOW_HASKELL__ >= 800
19{-# OPTIONS_GHC -freduction-depth=100 #-}
18{-# OPTIONS_GHC -freduction-depth=100 #-}
20−#else
21−{-# OPTIONS_GHC -fcontext-stack=100 #-}
22−#endif
23{-# OPTIONS_GHC -fno-warn-orphans #-}
19{-# OPTIONS_GHC -fno-warn-orphans #-}
24{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
20{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
25
21
26−#include "overlapping-compat.h"
27module Servant.ClientSpec (spec, Person(..), startWaiApp, endWaiApp) where
22module Servant.ClientSpec (spec, Person(..), startWaiApp, endWaiApp) where
28
23
29import Prelude ()
24import Prelude ()
servant-client/test/Servant/StreamSpec.hs−5
@@ -15,15 +15,10 @@
15{-# LANGUAGE TypeFamilies #-}
15{-# LANGUAGE TypeFamilies #-}
16{-# LANGUAGE TypeOperators #-}
16{-# LANGUAGE TypeOperators #-}
17{-# LANGUAGE UndecidableInstances #-}
17{-# LANGUAGE UndecidableInstances #-}
18−#if __GLASGOW_HASKELL__ >= 800
19{-# OPTIONS_GHC -freduction-depth=100 #-}
18{-# OPTIONS_GHC -freduction-depth=100 #-}
20−#else
21−{-# OPTIONS_GHC -fcontext-stack=100 #-}
22−#endif
23{-# OPTIONS_GHC -fno-warn-orphans #-}
19{-# OPTIONS_GHC -fno-warn-orphans #-}
24{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
20{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
25
21
26−#include "overlapping-compat.h"
27module Servant.StreamSpec (spec) where
22module Servant.StreamSpec (spec) where
28
23
29import Control.Monad
24import 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:
23homepage: http://haskell-servant.readthedocs.org/
23homepage: http://haskell-servant.readthedocs.org/
24Bug-reports: http://github.com/haskell-servant/servant/issues
24Bug-reports: http://github.com/haskell-servant/servant/issues
25extra-source-files:
25extra-source-files:
26− include/*.h
27 CHANGELOG.md
26 CHANGELOG.md
28 README.md
27 README.md
29source-repository head
28source-repository head
@@ -45,10 +44,6 @@ library
45 , bytestring >= 0.10.4.0 && < 0.11
44 , bytestring >= 0.10.4.0 && < 0.11
46 , text >= 1.2.3.0 && < 1.3
45 , text >= 1.2.3.0 && < 1.3
47
46
48− if !impl(ghc >= 8.0)
49− build-depends:
50− semigroups >=0.18.3 && <0.19
51−
52 -- Servant dependencies
47 -- Servant dependencies
53 build-depends:
48 build-depends:
54 servant == 0.13.* || ==0.14.*
49 servant == 0.13.* || ==0.14.*
@@ -70,10 +65,7 @@ library
70
65
71 hs-source-dirs: src
66 hs-source-dirs: src
72 default-language: Haskell2010
67 default-language: Haskell2010
73− ghc-options: -Wall
74− if impl(ghc >= 8.0)
75− ghc-options: -Wno-redundant-constraints
68+ ghc-options: -Wall -Wno-redundant-constraints
76− include-dirs: include
77
69
78executable greet-docs
70executable greet-docs
79 main-is: greet.hs
71 main-is: greet.hs
servant-docs/src/Servant/Docs/Internal.hs+4−6
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
2{-# LANGUAGE ConstraintKinds #-}
1{-# LANGUAGE ConstraintKinds #-}
3{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DataKinds #-}
4{-# LANGUAGE DefaultSignatures #-}
3{-# LANGUAGE DefaultSignatures #-}
@@ -17,7 +16,6 @@
17{-# LANGUAGE TypeOperators #-}
16{-# LANGUAGE TypeOperators #-}
18{-# LANGUAGE UndecidableInstances #-}
17{-# LANGUAGE UndecidableInstances #-}
19
18
20−#include "overlapping-compat.h"
21module Servant.Docs.Internal where
19module Servant.Docs.Internal where
22
20
23import Prelude ()
21import Prelude ()
@@ -788,7 +786,7 @@ markdownWith RenderingOptions{..} api = unlines $
788
786
789-- | The generated docs for @a ':<|>' b@ just appends the docs
787-- | The generated docs for @a ':<|>' b@ just appends the docs
790-- for @a@ with the docs for @b@.
788-- for @a@ with the docs for @b@.
791−instance OVERLAPPABLE_
789+instance {-# OVERLAPPABLE #-}
792 (HasDocs a, HasDocs b)
790 (HasDocs a, HasDocs b)
793 => HasDocs (a :<|> b) where
791 => HasDocs (a :<|> b) where
794
792
@@ -836,7 +834,7 @@ instance (KnownSymbol sym, ToCapture (CaptureAll sym a), HasDocs sublayout)
836 symP = Proxy :: Proxy sym
834 symP = Proxy :: Proxy sym
837
835
838
836
839−instance OVERLAPPABLE_
837+instance {-# OVERLAPPABLE #-}
840 (ToSample a, AllMimeRender (ct ': cts) a, KnownNat status
838 (ToSample a, AllMimeRender (ct ': cts) a, KnownNat status
841 , ReflectMethod method)
839 , ReflectMethod method)
842 => HasDocs (Verb method status (ct ': cts) a) where
840 => HasDocs (Verb method status (ct ': cts) a) where
@@ -855,7 +853,7 @@ instance OVERLAPPABLE_
855-- | TODO: mention the endpoint is streaming, its framing strategy
853-- | TODO: mention the endpoint is streaming, its framing strategy
856--
854--
857-- Also there are no samples.
855-- Also there are no samples.
858−instance OVERLAPPABLE_
856+instance {-# OVERLAPPABLE #-}
859 (MimeRender ct a, KnownNat status
857 (MimeRender ct a, KnownNat status
860 , ReflectMethod method)
858 , ReflectMethod method)
861 => HasDocs (Stream method status framing ct a) where
859 => HasDocs (Stream method status framing ct a) where
@@ -870,7 +868,7 @@ instance OVERLAPPABLE_
870 status = fromInteger $ natVal (Proxy :: Proxy status)
868 status = fromInteger $ natVal (Proxy :: Proxy status)
871 p = Proxy :: Proxy a
869 p = Proxy :: Proxy a
872
870
873−instance OVERLAPPING_
871+instance {-# OVERLAPPING #-}
874 (ToSample a, AllMimeRender (ct ': cts) a, KnownNat status
872 (ToSample a, AllMimeRender (ct ': cts) a, KnownNat status
875 , ReflectMethod method, AllHeaderSamples ls, GetHeaders (HList ls))
873 , ReflectMethod method, AllHeaderSamples ls, GetHeaders (HList ls))
876 => HasDocs (Verb method status (ct ': cts) (Headers ls a)) where
874 => HasDocs (Verb method status (ct ': cts) (Headers ls a)) where
servant-docs/test/Servant/DocsSpec.hs−5
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
2{-# LANGUAGE DataKinds #-}
1{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE DeriveGeneric #-}
2{-# LANGUAGE DeriveGeneric #-}
4{-# LANGUAGE FlexibleContexts #-}
3{-# LANGUAGE FlexibleContexts #-}
@@ -8,11 +7,7 @@
8{-# LANGUAGE TypeOperators #-}
7{-# LANGUAGE TypeOperators #-}
9{-# LANGUAGE TypeSynonymInstances #-}
8{-# LANGUAGE TypeSynonymInstances #-}
10{-# OPTIONS_GHC -fno-warn-orphans #-}
9{-# OPTIONS_GHC -fno-warn-orphans #-}
11−#if __GLASGOW_HASKELL__ >= 800
12{-# OPTIONS_GHC -freduction-depth=100 #-}
10{-# OPTIONS_GHC -freduction-depth=100 #-}
13−#else
14−{-# OPTIONS_GHC -fcontext-stack=100 #-}
15−#endif
16
11
17module Servant.DocsSpec where
12module Servant.DocsSpec where
18
13
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
19build-type: Simple
19build-type: Simple
20cabal-version: >=1.10
20cabal-version: >=1.10
21extra-source-files:
21extra-source-files:
22− include/*.h
23 CHANGELOG.md
22 CHANGELOG.md
24 README.md
23 README.md
25bug-reports: http://github.com/haskell-servant/servant/issues
24bug-reports: http://github.com/haskell-servant/servant/issues
@@ -45,10 +44,6 @@ library
45 base >= 4.7 && <4.12
44 base >= 4.7 && <4.12
46 , text >= 1.2.3.0 && < 1.3
45 , text >= 1.2.3.0 && < 1.3
47
46
48− if !impl(ghc >= 8.0)
49− build-depends:
50− semigroups >=0.18.3 && <0.19
51−
52 -- Servant dependencies
47 -- Servant dependencies
53 build-depends:
48 build-depends:
54 servant == 0.13.* || ==0.14.*
49 servant == 0.13.* || ==0.14.*
@@ -62,16 +57,12 @@ library
62
57
63 hs-source-dirs: src
58 hs-source-dirs: src
64 default-language: Haskell2010
59 default-language: Haskell2010
65− ghc-options: -Wall
66− if impl(ghc >= 8.0)
67− ghc-options: -Wno-redundant-constraints
60+ ghc-options: -Wall -Wno-redundant-constraints
68− include-dirs: include
69
61
70test-suite spec
62test-suite spec
71 type: exitcode-stdio-1.0
63 type: exitcode-stdio-1.0
72 hs-source-dirs: test
64 hs-source-dirs: test
73 ghc-options: -Wall
65 ghc-options: -Wall
74− include-dirs: include
75 main-is: Spec.hs
66 main-is: Spec.hs
76 other-modules: Servant.ForeignSpec
67 other-modules: Servant.ForeignSpec
77
68
servant-foreign/src/Servant/Foreign/Internal.hs−3
@@ -12,9 +12,6 @@
12{-# LANGUAGE TypeFamilies #-}
12{-# LANGUAGE TypeFamilies #-}
13{-# LANGUAGE TypeOperators #-}
13{-# LANGUAGE TypeOperators #-}
14{-# LANGUAGE UndecidableInstances #-}
14{-# LANGUAGE UndecidableInstances #-}
15−#if !MIN_VERSION_base(4,8,0)
16−{-# LANGUAGE NullaryTypeClasses #-}
17−#endif
18
15
19-- | Generalizes all the data needed to make code generation work with
16-- | Generalizes all the data needed to make code generation work with
20-- arbitrary programming languages.
17-- arbitrary programming languages.
servant-foreign/test/Servant/ForeignSpec.hs+2−7
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
2{-# LANGUAGE ConstraintKinds #-}
1{-# LANGUAGE ConstraintKinds #-}
3{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DataKinds #-}
4{-# LANGUAGE FlexibleContexts #-}
3{-# LANGUAGE FlexibleContexts #-}
@@ -9,10 +8,6 @@
9{-# LANGUAGE ScopedTypeVariables #-}
8{-# LANGUAGE ScopedTypeVariables #-}
10{-# LANGUAGE TypeFamilies #-}
9{-# LANGUAGE TypeFamilies #-}
11{-# LANGUAGE TypeOperators #-}
10{-# LANGUAGE TypeOperators #-}
12−#if __GLASGOW_HASKELL__ < 709
13−{-# OPTIONS_GHC -fcontext-stack=41 #-}
14−#endif
15−#include "overlapping-compat.h"
16
11
17module Servant.ForeignSpec where
12module Servant.ForeignSpec where
18
13
@@ -59,10 +54,10 @@ instance HasForeignType LangX String Int where
59instance HasForeignType LangX String Bool where
54instance HasForeignType LangX String Bool where
60 typeFor _ _ _ = "boolX"
55 typeFor _ _ _ = "boolX"
61
56
62−instance OVERLAPPING_ HasForeignType LangX String String where
57+instance {-# OVERLAPPING #-} HasForeignType LangX String String where
63 typeFor _ _ _ = "stringX"
58 typeFor _ _ _ = "stringX"
64
59
65−instance OVERLAPPABLE_ HasForeignType LangX String a => HasForeignType LangX String [a] where
60+instance {-# OVERLAPPABLE #-} HasForeignType LangX String a => HasForeignType LangX String [a] where
66 typeFor lang ftype _ = "listX of " <> typeFor lang ftype (Proxy :: Proxy a)
61 typeFor lang ftype _ = "listX of " <> typeFor lang ftype (Proxy :: Proxy a)
67
62
68instance (HasForeignType LangX String a) => HasForeignType LangX String (Maybe a) where
63instance (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}
2{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
3{-# OPTIONS_GHC -Wall #-}
2{-# OPTIONS_GHC -Wall #-}
4module Main (main) where
3module Main (main) where
@@ -16,6 +15,11 @@ main = defaultMainWithDoctests "doctests"
16#else
15#else
17
16
18#ifdef MIN_VERSION_Cabal
17#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
19#warning You are configuring this package without cabal-doctest installed. \
23#warning You are configuring this package without cabal-doctest installed. \
20 The doctests test-suite will not work as a result. \
24 The doctests test-suite will not work as a result. \
21 To fix this, install cabal-doctest before configuring.
25 To fix this, install cabal-doctest before configuring.
@@ -27,5 +31,3 @@ main :: IO ()
27main = defaultMain
31main = defaultMain
28
32
29#endif
33#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:
26 GHC==8.2.2
26 GHC==8.2.2
27 GHC==8.4.3
27 GHC==8.4.3
28extra-source-files:
28extra-source-files:
29− include/*.h
30 CHANGELOG.md
29 CHANGELOG.md
31 README.md
30 README.md
32
31
@@ -103,10 +102,7 @@ library
103
102
104 hs-source-dirs: src
103 hs-source-dirs: src
105 default-language: Haskell2010
104 default-language: Haskell2010
106− ghc-options: -Wall
107− if impl(ghc >= 8.0)
108− ghc-options: -Wno-redundant-constraints
105+ ghc-options: -Wall -Wno-redundant-constraints
109− include-dirs: include
110
106
111executable greet
107executable greet
112 main-is: greet.hs
108 main-is: greet.hs
@@ -187,4 +183,3 @@ test-suite doctests
187 ghc-options: -Wall -threaded
183 ghc-options: -Wall -threaded
188 if impl(ghc >= 8.2)
184 if impl(ghc >= 8.2)
189 x-doctest-options: -fdiagnostics-color=never
185 x-doctest-options: -fdiagnostics-color=never
190− include-dirs: include
servant-server/src/Servant/Server/Internal.hs+4−6
@@ -18,8 +18,6 @@
18#define HAS_TYPE_ERROR
18#define HAS_TYPE_ERROR
19#endif
19#endif
20
20
21−#include "overlapping-compat.h"
22−
23module Servant.Server.Internal
21module Servant.Server.Internal
24 ( module Servant.Server.Internal
22 ( module Servant.Server.Internal
25 , module Servant.Server.Internal.BasicAuth
23 , module Servant.Server.Internal.BasicAuth
@@ -256,7 +254,7 @@ methodRouter splitHeaders method proxy status action = leafRouter route'
256 let bdy = if allowedMethodHead method request then "" else body
254 let bdy = if allowedMethodHead method request then "" else body
257 in Route $ responseLBS status ((hContentType, cs contentT) : headers) bdy
255 in Route $ responseLBS status ((hContentType, cs contentT) : headers) bdy
258
256
259−instance OVERLAPPABLE_
257+instance {-# OVERLAPPABLE #-}
260 ( AllCTRender ctypes a, ReflectMethod method, KnownNat status
258 ( AllCTRender ctypes a, ReflectMethod method, KnownNat status
261 ) => HasServer (Verb method status ctypes a) context where
259 ) => HasServer (Verb method status ctypes a) context where
262
260
@@ -267,7 +265,7 @@ instance OVERLAPPABLE_
267 where method = reflectMethod (Proxy :: Proxy method)
265 where method = reflectMethod (Proxy :: Proxy method)
268 status = toEnum . fromInteger $ natVal (Proxy :: Proxy status)
266 status = toEnum . fromInteger $ natVal (Proxy :: Proxy status)
269
267
270−instance OVERLAPPING_
268+instance {-# OVERLAPPING #-}
271 ( AllCTRender ctypes a, ReflectMethod method, KnownNat status
269 ( AllCTRender ctypes a, ReflectMethod method, KnownNat status
272 , GetHeaders (Headers h a)
270 , GetHeaders (Headers h a)
273 ) => HasServer (Verb method status ctypes (Headers h a)) context where
271 ) => HasServer (Verb method status ctypes (Headers h a)) context where
@@ -280,7 +278,7 @@ instance OVERLAPPING_
280 status = toEnum . fromInteger $ natVal (Proxy :: Proxy status)
278 status = toEnum . fromInteger $ natVal (Proxy :: Proxy status)
281
279
282
280
283−instance OVERLAPPABLE_
281+instance {-# OVERLAPPABLE #-}
284 ( MimeRender ctype a, ReflectMethod method, KnownNat status,
282 ( MimeRender ctype a, ReflectMethod method, KnownNat status,
285 FramingRender framing ctype, ToStreamGenerator b a
283 FramingRender framing ctype, ToStreamGenerator b a
286 ) => HasServer (Stream method status framing ctype b) context where
284 ) => HasServer (Stream method status framing ctype b) context where
@@ -292,7 +290,7 @@ instance OVERLAPPABLE_
292 where method = reflectMethod (Proxy :: Proxy method)
290 where method = reflectMethod (Proxy :: Proxy method)
293 status = toEnum . fromInteger $ natVal (Proxy :: Proxy status)
291 status = toEnum . fromInteger $ natVal (Proxy :: Proxy status)
294
292
295−instance OVERLAPPING_
293+instance {-# OVERLAPPING #-}
296 ( MimeRender ctype a, ReflectMethod method, KnownNat status,
294 ( MimeRender ctype a, ReflectMethod method, KnownNat status,
297 FramingRender framing ctype, ToStreamGenerator b a,
295 FramingRender framing ctype, ToStreamGenerator b a,
298 GetHeaders (Headers h b)
296 GetHeaders (Headers h b)
servant-server/src/Servant/Server/Internal/Context.hs+2−5
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
2{-# LANGUAGE DataKinds #-}
1{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE FlexibleContexts #-}
2{-# LANGUAGE FlexibleContexts #-}
4{-# LANGUAGE FlexibleInstances #-}
3{-# LANGUAGE FlexibleInstances #-}
@@ -8,8 +7,6 @@
8{-# LANGUAGE ScopedTypeVariables #-}
7{-# LANGUAGE ScopedTypeVariables #-}
9{-# LANGUAGE TypeOperators #-}
8{-# LANGUAGE TypeOperators #-}
10
9
11−#include "overlapping-compat.h"
12−
13module Servant.Server.Internal.Context where
10module Servant.Server.Internal.Context where
14
11
15import Data.Proxy
12import Data.Proxy
@@ -64,11 +61,11 @@ instance (Eq a, Eq (Context as)) => Eq (Context (a ': as)) where
64class HasContextEntry (context :: [*]) (val :: *) where
61class HasContextEntry (context :: [*]) (val :: *) where
65 getContextEntry :: Context context -> val
62 getContextEntry :: Context context -> val
66
63
67−instance OVERLAPPABLE_
64+instance {-# OVERLAPPABLE #-}
68 HasContextEntry xs val => HasContextEntry (notIt ': xs) val where
65 HasContextEntry xs val => HasContextEntry (notIt ': xs) val where
69 getContextEntry (_ :. xs) = getContextEntry xs
66 getContextEntry (_ :. xs) = getContextEntry xs
70
67
71−instance OVERLAPPING_
68+instance {-# OVERLAPPING #-}
72 HasContextEntry (val ': xs) val where
69 HasContextEntry (val ': xs) val where
73 getContextEntry (x :. _) = x
70 getContextEntry (x :. _) = x
74
71
servant-server/src/Servant/Server/StaticFiles.hs+1−10
@@ -24,10 +24,6 @@ import Servant.Server
24 (ServerT, Tagged (..))
24 (ServerT, Tagged (..))
25import System.FilePath
25import System.FilePath
26 (addTrailingPathSeparator)
26 (addTrailingPathSeparator)
27−#if !MIN_VERSION_wai_app_static(3,1,0)
28−import Filesystem.Path.CurrentOS
29− (decodeString)
30−#endif
31import WaiAppStatic.Storage.Filesystem
27import WaiAppStatic.Storage.Filesystem
32 (ETagLookup)
28 (ETagLookup)
33
29
@@ -84,9 +80,4 @@ serveDirectory = serveDirectoryFileServer
84{-# DEPRECATED serveDirectory "Use serveDirectoryFileServer instead" #-}
80{-# DEPRECATED serveDirectory "Use serveDirectoryFileServer instead" #-}
85
81
86fixPath :: FilePath -> FilePath
82fixPath :: FilePath -> FilePath
87−fixPath =
88−#if MIN_VERSION_wai_app_static(3,1,0)
89− addTrailingPathSeparator
90−#else
91− decodeString . addTrailingPathSeparator
83+fixPath = addTrailingPathSeparator
92−#endif
servant-server/test/Servant/ServerSpec.hs−5
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
2{-# LANGUAGE DataKinds #-}
1{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE DeriveGeneric #-}
2{-# LANGUAGE DeriveGeneric #-}
4{-# LANGUAGE FlexibleContexts #-}
3{-# LANGUAGE FlexibleContexts #-}
@@ -9,11 +8,7 @@
9{-# LANGUAGE TypeFamilies #-}
8{-# LANGUAGE TypeFamilies #-}
10{-# LANGUAGE TypeOperators #-}
9{-# LANGUAGE TypeOperators #-}
11{-# LANGUAGE TypeSynonymInstances #-}
10{-# LANGUAGE TypeSynonymInstances #-}
12−#if __GLASGOW_HASKELL__ >= 800
13{-# OPTIONS_GHC -freduction-depth=100 #-}
11{-# OPTIONS_GHC -freduction-depth=100 #-}
14−#else
15−{-# OPTIONS_GHC -fcontext-stack=100 #-}
16−#endif
17
12
18module Servant.ServerSpec where
13module Servant.ServerSpec where
19
14
servant/Setup.lhs → servant/Setup.hsrenamed+5−3
@@ -1,4 +1,3 @@
1−\begin{code}
2{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
3{-# OPTIONS_GHC -Wall #-}
2{-# OPTIONS_GHC -Wall #-}
4module Main (main) where
3module Main (main) where
@@ -16,6 +15,11 @@ main = defaultMainWithDoctests "doctests"
16#else
15#else
17
16
18#ifdef MIN_VERSION_Cabal
17#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
19#warning You are configuring this package without cabal-doctest installed. \
23#warning You are configuring this package without cabal-doctest installed. \
20 The doctests test-suite will not work as a result. \
24 The doctests test-suite will not work as a result. \
21 To fix this, install cabal-doctest before configuring.
25 To fix this, install cabal-doctest before configuring.
@@ -27,5 +31,3 @@ main :: IO ()
27main = defaultMain
31main = defaultMain
28
32
29#endif
33#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:
22 GHC==8.2.2
22 GHC==8.2.2
23 GHC==8.4.3
23 GHC==8.4.3
24extra-source-files:
24extra-source-files:
25− include/*.h
26 CHANGELOG.md
25 CHANGELOG.md
27source-repository head
26source-repository head
28 type: git
27 type: git
@@ -120,10 +119,7 @@ library
120 , TypeOperators
119 , TypeOperators
121 , TypeSynonymInstances
120 , TypeSynonymInstances
122 , UndecidableInstances
121 , UndecidableInstances
123− ghc-options: -Wall
124− if impl(ghc >= 8.0)
125− ghc-options: -Wno-redundant-constraints
122+ ghc-options: -Wall -Wno-redundant-constraints
126− include-dirs: include
127
123
128test-suite spec
124test-suite spec
129 type: exitcode-stdio-1.0
125 type: exitcode-stdio-1.0
@@ -146,10 +142,6 @@ test-suite spec
146 , string-conversions
142 , string-conversions
147 , text
143 , text
148
144
149− if !impl(ghc >= 8.0)
150− build-depends:
151− semigroups
152−
153 -- Additonal dependencies
145 -- Additonal dependencies
154 build-depends:
146 build-depends:
155 aeson-compat >= 0.3.8 && < 0.4
147 aeson-compat >= 0.3.8 && < 0.4
@@ -177,6 +169,5 @@ test-suite doctests
177 ghc-options: -Wall -threaded
169 ghc-options: -Wall -threaded
178 if impl(ghc >= 8.2)
170 if impl(ghc >= 8.2)
179 x-doctest-options: -fdiagnostics-color=never
171 x-doctest-options: -fdiagnostics-color=never
180− include-dirs: include
181 x-doctest-source-dirs: test
172 x-doctest-source-dirs: test
182 x-doctest-modules: Servant.LinksSpec
173 x-doctest-modules: Servant.LinksSpec
servant/src/Servant/API/ContentTypes.hs+8−16
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
2{-# LANGUAGE ConstraintKinds #-}
1{-# LANGUAGE ConstraintKinds #-}
3{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DataKinds #-}
4{-# LANGUAGE DeriveDataTypeable #-}
3{-# LANGUAGE DeriveDataTypeable #-}
@@ -14,8 +13,6 @@
14{-# LANGUAGE UndecidableInstances #-}
13{-# LANGUAGE UndecidableInstances #-}
15{-# OPTIONS_HADDOCK not-home #-}
14{-# OPTIONS_HADDOCK not-home #-}
16
15
17−#include "overlapping-compat.h"
18−
19-- | A collection of basic Content-Types (also known as Internet Media
16-- | A collection of basic Content-Types (also known as Internet Media
20-- Types, or MIME types). Additionally, this module provides classes that
17-- Types, or MIME types). Additionally, this module provides classes that
21-- encapsulate how to serialize or deserialize values to or from
18-- encapsulate how to serialize or deserialize values to or from
@@ -98,16 +95,13 @@ import qualified Data.Text.Lazy.Encoding as TextL
98import Data.Typeable
95import Data.Typeable
99import GHC.Generics
96import GHC.Generics
100 (Generic)
97 (Generic)
98+import qualified GHC.TypeLits as TL
101import qualified Network.HTTP.Media as M
99import qualified Network.HTTP.Media as M
102import Prelude ()
100import Prelude ()
103import Prelude.Compat
101import Prelude.Compat
104import Web.FormUrlEncoded
102import Web.FormUrlEncoded
105 (FromForm, ToForm, urlDecodeAsForm, urlEncodeAsForm)
103 (FromForm, ToForm, urlDecodeAsForm, urlEncodeAsForm)
106
104
107−#if MIN_VERSION_base(4,9,0)
108−import qualified GHC.TypeLits as TL
109−#endif
110−
111-- * Provided content types
105-- * Provided content types
112data JSON deriving Typeable
106data JSON deriving Typeable
113data PlainText deriving Typeable
107data PlainText deriving Typeable
@@ -185,18 +179,16 @@ class (AllMime list) => AllCTRender (list :: [*]) a where
185 -- mimetype).
179 -- mimetype).
186 handleAcceptH :: Proxy list -> AcceptHeader -> a -> Maybe (ByteString, ByteString)
180 handleAcceptH :: Proxy list -> AcceptHeader -> a -> Maybe (ByteString, ByteString)
187
181
188−instance OVERLAPPABLE_
182+instance {-# OVERLAPPABLE #-}
189 (Accept ct, AllMime cts, AllMimeRender (ct ': cts) a) => AllCTRender (ct ': cts) a where
183 (Accept ct, AllMime cts, AllMimeRender (ct ': cts) a) => AllCTRender (ct ': cts) a where
190 handleAcceptH _ (AcceptHeader accept) val = M.mapAcceptMedia lkup accept
184 handleAcceptH _ (AcceptHeader accept) val = M.mapAcceptMedia lkup accept
191 where pctyps = Proxy :: Proxy (ct ': cts)
185 where pctyps = Proxy :: Proxy (ct ': cts)
192 amrs = allMimeRender pctyps val
186 amrs = allMimeRender pctyps val
193 lkup = fmap (\(a,b) -> (a, (fromStrict $ M.renderHeader a, b))) amrs
187 lkup = fmap (\(a,b) -> (a, (fromStrict $ M.renderHeader a, b))) amrs
194
188
195−#if MIN_VERSION_base(4,9,0)
196instance TL.TypeError ('TL.Text "No instance for (), use NoContent instead.")
189instance TL.TypeError ('TL.Text "No instance for (), use NoContent instead.")
197 => AllCTRender '[] () where
190 => AllCTRender '[] () where
198 handleAcceptH _ _ _ = error "unreachable"
191 handleAcceptH _ _ _ = error "unreachable"
199−#endif
200
192
201--------------------------------------------------------------------------
193--------------------------------------------------------------------------
202-- * Unrender
194-- * Unrender
@@ -277,13 +269,13 @@ class (AllMime list) => AllMimeRender (list :: [*]) a where
277 -> a -- value to serialize
269 -> a -- value to serialize
278 -> [(M.MediaType, ByteString)] -- content-types/response pairs
270 -> [(M.MediaType, ByteString)] -- content-types/response pairs
279
271
280−instance OVERLAPPABLE_ ( MimeRender ctyp a ) => AllMimeRender '[ctyp] a where
272+instance {-# OVERLAPPABLE #-} ( MimeRender ctyp a ) => AllMimeRender '[ctyp] a where
281 allMimeRender _ a = map (, bs) $ NE.toList $ contentTypes pctyp
273 allMimeRender _ a = map (, bs) $ NE.toList $ contentTypes pctyp
282 where
274 where
283 bs = mimeRender pctyp a
275 bs = mimeRender pctyp a
284 pctyp = Proxy :: Proxy ctyp
276 pctyp = Proxy :: Proxy ctyp
285
277
286−instance OVERLAPPABLE_
278+instance {-# OVERLAPPABLE #-}
287 ( MimeRender ctyp a
279 ( MimeRender ctyp a
288 , AllMimeRender (ctyp' ': ctyps) a
280 , AllMimeRender (ctyp' ': ctyps) a
289 ) => AllMimeRender (ctyp ': ctyp' ': ctyps) a where
281 ) => AllMimeRender (ctyp ': ctyp' ': ctyps) a where
@@ -299,12 +291,12 @@ instance OVERLAPPABLE_
299-- Ideally we would like to declare a 'MimeRender a NoContent' instance, and
291-- Ideally we would like to declare a 'MimeRender a NoContent' instance, and
300-- then this would be taken care of. However there is no more specific instance
292-- then this would be taken care of. However there is no more specific instance
301-- between that and 'MimeRender JSON a', so we do this instead
293-- 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
303 allMimeRender _ _ = map (, "") $ NE.toList $ contentTypes pctyp
295 allMimeRender _ _ = map (, "") $ NE.toList $ contentTypes pctyp
304 where
296 where
305 pctyp = Proxy :: Proxy ctyp
297 pctyp = Proxy :: Proxy ctyp
306
298
307−instance OVERLAPPING_
299+instance {-# OVERLAPPING #-}
308 ( AllMime (ctyp ': ctyp' ': ctyps)
300 ( AllMime (ctyp ': ctyp' ': ctyps)
309 ) => AllMimeRender (ctyp ': ctyp' ': ctyps) NoContent where
301 ) => AllMimeRender (ctyp ': ctyp' ': ctyps) NoContent where
310 allMimeRender p _ = zip (allMime p) (repeat "")
302 allMimeRender p _ = zip (allMime p) (repeat "")
@@ -334,14 +326,14 @@ instance ( MimeUnrender ctyp a
334-- * MimeRender Instances
326-- * MimeRender Instances
335
327
336-- | `encode`
328-- | `encode`
337−instance OVERLAPPABLE_
329+instance {-# OVERLAPPABLE #-}
338 ToJSON a => MimeRender JSON a where
330 ToJSON a => MimeRender JSON a where
339 mimeRender _ = encode
331 mimeRender _ = encode
340
332
341-- | @urlEncodeAsForm@
333-- | @urlEncodeAsForm@
342-- Note that the @mimeUnrender p (mimeRender p x) == Right x@ law only
334-- Note that the @mimeUnrender p (mimeRender p x) == Right x@ law only
343-- holds if every element of x is non-null (i.e., not @("", "")@)
335-- holds if every element of x is non-null (i.e., not @("", "")@)
344−instance OVERLAPPABLE_
336+instance {-# OVERLAPPABLE #-}
345 ToForm a => MimeRender FormUrlEncoded a where
337 ToForm a => MimeRender FormUrlEncoded a where
346 mimeRender _ = urlEncodeAsForm
338 mimeRender _ = urlEncodeAsForm
347
339
servant/src/Servant/API/ResponseHeaders.hs+4−6
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
2{-# LANGUAGE DataKinds #-}
1{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE DeriveDataTypeable #-}
2{-# LANGUAGE DeriveDataTypeable #-}
4{-# LANGUAGE DeriveFunctor #-}
3{-# LANGUAGE DeriveFunctor #-}
@@ -15,7 +14,6 @@
15{-# LANGUAGE UndecidableInstances #-}
14{-# LANGUAGE UndecidableInstances #-}
16{-# OPTIONS_HADDOCK not-home #-}
15{-# OPTIONS_HADDOCK not-home #-}
17
16
18−#include "overlapping-compat.h"
19-- | This module provides facilities for adding headers to a response.
17-- | This module provides facilities for adding headers to a response.
20--
18--
21-- >>> let headerVal = addHeader "some-url" 5 :: Headers '[Header "Location" String] Int
19-- >>> let headerVal = addHeader "some-url" 5 :: Headers '[Header "Location" String] Int
@@ -80,10 +78,10 @@ class BuildHeadersTo hs where
80 -- the values are interspersed with commas before deserialization (see
78 -- the values are interspersed with commas before deserialization (see
81 -- <http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 RFC2616 Sec 4.2>)
79 -- <http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 RFC2616 Sec 4.2>)
82
80
83−instance OVERLAPPING_ BuildHeadersTo '[] where
81+instance {-# OVERLAPPING #-} BuildHeadersTo '[] where
84 buildHeadersTo _ = HNil
82 buildHeadersTo _ = HNil
85
83
86−instance OVERLAPPABLE_ ( FromHttpApiData v, BuildHeadersTo xs, KnownSymbol h )
84+instance {-# OVERLAPPABLE #-} ( FromHttpApiData v, BuildHeadersTo xs, KnownSymbol h )
87 => BuildHeadersTo (Header h v ': xs) where
85 => BuildHeadersTo (Header h v ': xs) where
88 buildHeadersTo headers =
86 buildHeadersTo headers =
89 let wantedHeader = CI.mk . pack $ symbolVal (Proxy :: Proxy h)
87 let wantedHeader = CI.mk . pack $ symbolVal (Proxy :: Proxy h)
@@ -144,11 +142,11 @@ class AddHeader h v orig new
144 addOptionalHeader :: ResponseHeader h v -> orig -> new -- ^ N.B.: The same header can't be added multiple times
142 addOptionalHeader :: ResponseHeader h v -> orig -> new -- ^ N.B.: The same header can't be added multiple times
145
143
146
144
147−instance OVERLAPPING_ ( KnownSymbol h, ToHttpApiData v )
145+instance {-# OVERLAPPING #-} ( KnownSymbol h, ToHttpApiData v )
148 => AddHeader h v (Headers (fst ': rest) a) (Headers (Header h v ': fst ': rest) a) where
146 => AddHeader h v (Headers (fst ': rest) a) (Headers (Header h v ': fst ': rest) a) where
149 addOptionalHeader hdr (Headers resp heads) = Headers resp (HCons hdr heads)
147 addOptionalHeader hdr (Headers resp heads) = Headers resp (HCons hdr heads)
150
148
151−instance OVERLAPPABLE_ ( KnownSymbol h, ToHttpApiData v
149+instance {-# OVERLAPPABLE #-} ( KnownSymbol h, ToHttpApiData v
152 , new ~ (Headers '[Header h v] a) )
150 , new ~ (Headers '[Header h v] a) )
153 => AddHeader h v a new where
151 => AddHeader h v a new where
154 addOptionalHeader hdr resp = Headers resp (HCons hdr HNil)
152 addOptionalHeader hdr resp = Headers resp (HCons hdr HNil)
servant/src/Servant/API/TypeLevel.hs−15
@@ -41,9 +41,6 @@ module Servant.API.TypeLevel (
41 -- ** Logic
41 -- ** Logic
42 Or,
42 Or,
43 And,
43 And,
44− -- * Custom type errors
45− -- | Before @base-4.9.0.0@ we use non-exported 'ElemNotFoundIn' class,
46− -- which cannot be instantiated.
47 ) where
44 ) where
48
45
49
46
@@ -63,10 +60,8 @@ import Servant.API.Sub
63 (type (:>))
60 (type (:>))
64import Servant.API.Verbs
61import Servant.API.Verbs
65 (Verb)
62 (Verb)
66−#if MIN_VERSION_base(4,9,0)
67import GHC.TypeLits
63import GHC.TypeLits
68 (ErrorMessage (..), TypeError)
64 (ErrorMessage (..), TypeError)
69−#endif
70
65
71
66
72
67
@@ -222,14 +217,10 @@ type Elem e es = ElemGo e es es
222type family ElemGo e es orig :: Constraint where
217type family ElemGo e es orig :: Constraint where
223 ElemGo x (x ': xs) orig = ()
218 ElemGo x (x ': xs) orig = ()
224 ElemGo y (x ': xs) orig = ElemGo y xs orig
219 ElemGo y (x ': xs) orig = ElemGo y xs orig
225−#if MIN_VERSION_base(4,9,0)
226 -- Note [Custom Errors]
220 -- Note [Custom Errors]
227 ElemGo x '[] orig = TypeError ('ShowType x
221 ElemGo x '[] orig = TypeError ('ShowType x
228 ':<>: 'Text " expected in list "
222 ':<>: 'Text " expected in list "
229 ':<>: 'ShowType orig)
223 ':<>: 'ShowType orig)
230−#else
231− ElemGo x '[] orig = ElemNotFoundIn x orig
232−#endif
233
224
234-- ** Logic
225-- ** Logic
235
226
@@ -244,12 +235,6 @@ type family Or (a :: Constraint) (b :: Constraint) :: Constraint where
244type family And (a :: Constraint) (b :: Constraint) :: Constraint where
235type family And (a :: Constraint) (b :: Constraint) :: Constraint where
245 And () () = ()
236 And () () = ()
246
237
247−-- * Custom type errors
248−
249−#if !MIN_VERSION_base(4,9,0)
250−class ElemNotFoundIn val list
251−#endif
252−
253{- Note [Custom Errors]
238{- Note [Custom Errors]
254~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
239~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
255We might try to factor these our more cleanly, but the type synonyms and type
240We 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 #-}
2{-# LANGUAGE DataKinds #-}
1{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE DeriveGeneric #-}
2{-# LANGUAGE DeriveGeneric #-}
4{-# LANGUAGE MultiParamTypeClasses #-}
3{-# LANGUAGE MultiParamTypeClasses #-}
@@ -195,7 +194,6 @@ spec = describe "Servant.API.ContentTypes" $ do
195 handleCTypeH (Proxy :: Proxy '[JSONorText]) "image/jpeg"
194 handleCTypeH (Proxy :: Proxy '[JSONorText]) "image/jpeg"
196 "foobar" `shouldBe` (Nothing :: Maybe (Either String Int))
195 "foobar" `shouldBe` (Nothing :: Maybe (Either String Int))
197
196
198−#if MIN_VERSION_aeson(0,9,0)
199 -- aeson >= 0.9 decodes top-level strings
197 -- aeson >= 0.9 decodes top-level strings
200 describe "eitherDecodeLenient" $ do
198 describe "eitherDecodeLenient" $ do
201
199
@@ -204,7 +202,6 @@ spec = describe "Servant.API.ContentTypes" $ do
204 -- The Left messages differ, so convert to Maybe
202 -- The Left messages differ, so convert to Maybe
205 property $ \x -> toMaybe (eitherDecodeLenient x)
203 property $ \x -> toMaybe (eitherDecodeLenient x)
206 `shouldBe` (decode x :: Maybe String)
204 `shouldBe` (decode x :: Maybe String)
207−#endif
208
205
209
206
210data SomeData = SomeData { record1 :: String, record2 :: Int }
207data SomeData = SomeData { record1 :: String, record2 :: Int }
servant/test/Servant/LinksSpec.hs−4
@@ -1,12 +1,8 @@
1−{-# LANGUAGE CPP #-}
2{-# LANGUAGE ConstraintKinds #-}
1{-# LANGUAGE ConstraintKinds #-}
3{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DataKinds #-}
4{-# LANGUAGE PolyKinds #-}
3{-# LANGUAGE PolyKinds #-}
5{-# LANGUAGE ScopedTypeVariables #-}
4{-# LANGUAGE ScopedTypeVariables #-}
6{-# LANGUAGE TypeOperators #-}
5{-# LANGUAGE TypeOperators #-}
7−#if __GLASGOW_HASKELL__ < 709
8−{-# OPTIONS_GHC -fcontext-stack=41 #-}
9−#endif
10module Servant.LinksSpec where
6module Servant.LinksSpec where
11
7
12import Data.Proxy
8import Data.Proxy