Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove base-compat dependency from servant #1744

Merged
merged 2 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions servant/servant.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ library
-- Other dependencies: Lower bound around what is in the latest Stackage LTS.
-- Here can be exceptions if we really need features from the newer versions.
build-depends:
base-compat >= 0.10.5 && < 0.14
, aeson >= 1.4.1.0 && < 2.3
aeson >= 1.4.1.0 && < 2.3
, attoparsec >= 0.13.2.2 && < 0.15
, bifunctors >= 5.5.3 && < 5.7
, case-insensitive >= 1.2.0.11 && < 1.3
Expand Down
2 changes: 0 additions & 2 deletions servant/src/Servant/API/Alternative.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import Data.Bitraversable
(Bitraversable (..))
import Data.Typeable
(Typeable)
import Prelude ()
import Prelude.Compat

-- | Union of two APIs, first takes precedence in case of overlap.
--
Expand Down
5 changes: 1 addition & 4 deletions servant/src/Servant/API/ContentTypes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ module Servant.API.ContentTypes

import Control.Arrow
(left)
import Control.Monad.Compat
import Control.DeepSeq
(NFData)
import Data.Aeson
Expand All @@ -97,8 +96,6 @@ import GHC.Generics
(Generic)
import qualified GHC.TypeLits as TL
import qualified Network.HTTP.Media as M
import Prelude ()
import Prelude.Compat
import Web.FormUrlEncoded
(FromForm, ToForm, urlDecodeAsForm, urlEncodeAsForm)

Expand Down Expand Up @@ -299,7 +296,7 @@ instance {-# OVERLAPPING #-} ( Accept ctyp ) => AllMimeRender '[ctyp] NoContent
instance {-# OVERLAPPING #-}
( AllMime (ctyp ': ctyp' ': ctyps)
) => AllMimeRender (ctyp ': ctyp' ': ctyps) NoContent where
allMimeRender p _ = zip (allMime p) (repeat "")
allMimeRender p _ = map (, "") (allMime p)

--------------------------------------------------------------------------
-- Check that all elements of list are instances of MimeUnrender
Expand Down
5 changes: 1 addition & 4 deletions servant/src/Servant/API/Empty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
{-# OPTIONS_HADDOCK not-home #-}
module Servant.API.Empty(EmptyAPI(..)) where

import Data.Typeable
(Typeable)
import Prelude ()
import Prelude.Compat
import Data.Typeable (Typeable)

-- | An empty API: one which serves nothing. Morally speaking, this should be
-- the unit of ':<|>'. Implementors of interpretations of API types should
Expand Down
5 changes: 1 addition & 4 deletions servant/src/Servant/API/ResponseHeaders.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}

{-# LANGUAGE TypeFamilyDependencies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
Expand Down Expand Up @@ -53,8 +52,6 @@ import qualified Network.HTTP.Types.Header as HTTP
import Web.HttpApiData
(FromHttpApiData, ToHttpApiData, parseHeader, toHeader)

import Prelude ()
import Prelude.Compat
import Servant.API.Header
(Header')
import Servant.API.Modifiers
Expand Down
18 changes: 9 additions & 9 deletions servant/src/Servant/Links.hs
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}

{-# OPTIONS_HADDOCK not-home #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# OPTIONS_GHC -Wno-missing-methods #-}

-- | Type safe generation of internal links.
--
Expand Down Expand Up @@ -145,8 +147,6 @@ import GHC.TypeLits
(KnownSymbol, TypeError, symbolVal)
import Network.URI
(URI (..), escapeURIString, isUnreserved)
import Prelude ()
import Prelude.Compat

import Servant.API.Alternative
((:<|>) ((:<|>)))
Expand Down Expand Up @@ -660,19 +660,19 @@ simpleToLink _ toA _ = toLink toA (Proxy :: Proxy sub)
-- >>> import Data.Text (Text)

-- Erroring instance for 'HasLink' when a combinator is not fully applied
instance TypeError (PartialApplication
instance TypeError (PartialApplication
#if __GLASGOW_HASKELL__ >= 904
@(Type -> Constraint)
@(Type -> Constraint)
#endif
HasLink arr) => HasLink ((arr :: a -> b) :> sub)
where
type MkLink (arr :> sub) _ = TypeError (PartialApplication (HasLink :: Type -> Constraint) arr)
toLink = error "unreachable"

-- Erroring instances for 'HasLink' for unknown API combinators
instance {-# OVERLAPPABLE #-} TypeError (NoInstanceForSub
instance {-# OVERLAPPABLE #-} TypeError (NoInstanceForSub
#if __GLASGOW_HASKELL__ >= 904
@(Type -> Constraint)
@(Type -> Constraint)
#endif
HasLink ty) => HasLink (ty :> sub)

Expand Down
4 changes: 1 addition & 3 deletions servant/src/Servant/Types/SourceT.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ import Data.Functor.Classes
(Show1 (..), showsBinaryWith, showsPrec1, showsUnaryWith)
import Data.Functor.Identity
(Identity (..))
import Prelude ()
import Prelude.Compat hiding
(readFile)
import Prelude hiding (readFile)
import System.IO
(Handle, IOMode (..), withFile)
import qualified Test.QuickCheck as QC
Expand Down
Loading