@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE AllowAmbiguousTypes #-}
32{-# LANGUAGE ConstraintKinds #-}
43{-# LANGUAGE DataKinds #-}
@@ -9,6 +8,7 @@
98{-# LANGUAGE MultiParamTypeClasses #-}
109{-# LANGUAGE OverloadedStrings #-}
1110{-# LANGUAGE PolyKinds #-}
11+{-# LANGUAGE QuantifiedConstraints #-}
1212{-# LANGUAGE RankNTypes #-}
1313{-# LANGUAGE ScopedTypeVariables #-}
1414{-# LANGUAGE TupleSections #-}
@@ -17,14 +17,6 @@
1717{-# LANGUAGE TypeOperators #-}
1818{-# LANGUAGE UndecidableInstances #-}
1919
20−#if MIN_VERSION_base(4,9,0) && __GLASGOW_HASKELL__ >= 802
21−#define HAS_TYPE_ERROR
22−#endif
23−
24−#if __GLASGOW_HASKELL__ >= 806
25−{-# LANGUAGE QuantifiedConstraints #-}
26−#endif
27−
2820module Servant.Server.Internal
2921 ( module Servant.Server.Internal
3022 , module Servant.Server.Internal.BasicAuth
@@ -111,12 +103,10 @@ import Servant.Server.Internal.RouteResult
111103import Servant.Server.Internal.RoutingApplication
112104import Servant.Server.Internal.ServerError
113105
114−#ifdef HAS_TYPE_ERROR
115106import GHC.TypeLits
116107 (ErrorMessage (..), TypeError)
117108import Servant.API.TypeLevel
118109 (AtLeastOneFragment, FragmentUnique)
119−#endif
120110
121111class HasServer api context where
122112 type ServerT api (m :: * -> *) :: *
@@ -794,7 +784,7 @@ instance ( KnownSymbol realm
794784-- * helpers
795785
796786ct_wildcard :: B.ByteString
797−ct_wildcard = "*" <> "/" <> "*" -- Because CPP
787+ct_wildcard = "*" <> "/" <> "*"
798788
799789getAcceptHeader :: Request -> AcceptHeader
800790getAcceptHeader = AcceptHeader . fromMaybe ct_wildcard . lookup hAccept . requestHeaders
@@ -825,7 +815,6 @@ instance (HasContextEntry context (NamedContext name subContext), HasServer subA
825815-- TypeError helpers
826816-------------------------------------------------------------------------------
827817
828−#ifdef HAS_TYPE_ERROR
829818-- | This instance catches mistakes when there are non-saturated
830819-- type applications on LHS of ':>'.
831820--
@@ -888,7 +877,6 @@ type HasServerArrowTypeError a b =
888877 ':$$: 'ShowType a
889878 ':$$: 'Text "and"
890879 ':$$: 'ShowType b
891−#endif
892880
893881-- | Ignore @'Fragment'@ in server handlers.
894882-- See <https://ietf.org/rfc/rfc2616.html#section-15.1.3> for more details.
@@ -901,11 +889,7 @@ type HasServerArrowTypeError a b =
901889-- > server = getBooks
902890-- > where getBooks :: Handler [Book]
903891-- > getBooks = ...return all books...
904−#ifdef HAS_TYPE_ERROR
905892instance (AtLeastOneFragment api, FragmentUnique (Fragment a1 :> api), HasServer api context)
906−#else
907−instance (HasServer api context)
908−#endif
909893 => HasServer (Fragment a1 :> api) context where
910894 type ServerT (Fragment a1 :> api) m = ServerT api m
911895
@@ -924,8 +908,6 @@ instance GenericMode (AsServerT m) where
924908type AsServer = AsServerT Handler
925909
926910
927−#if __GLASGOW_HASKELL__ >= 806
928−
929911-- | Set of constraints required to convert to / from vanilla server types.
930912type GServerConstraints api m =
931913 ( ToServant api (AsServerT m) ~ ServerT (ToServantApi api) m
@@ -986,5 +968,3 @@ instance
986968 toServant server
987969 servantSrvN :: ServerT (ToServantApi api) n =
988970 hoistServerWithContext (Proxy @(ToServantApi api)) pctx nat servantSrvM
989−
990−#endif