Drop support for GHC-7.8.4

This commit is contained in:
Danny Navarro 2016-11-27 12:38:31 -03:00
parent 2cc6b00051
commit 61f0a06096
No known key found for this signature in database
GPG Key ID: 81E5F99780FA6A32
8 changed files with 9 additions and 42 deletions

View File

@ -19,7 +19,7 @@ import Data.GraphQL.Error
-- executed according to the given 'Schema'. -- executed according to the given 'Schema'.
-- --
-- Returns the response as an @Aeson.@'Aeson.Value'. -- Returns the response as an @Aeson.@'Aeson.Value'.
graphql :: (Alternative m, Monad m) => Schema m -> Text -> m Aeson.Value graphql :: Alternative m => Schema m -> Text -> m Aeson.Value
graphql = flip graphqlSubs $ const Nothing graphql = flip graphqlSubs $ const Nothing
-- | Takes a 'Schema', a variable substitution function and text -- | Takes a 'Schema', a variable substitution function and text
@ -28,7 +28,7 @@ graphql = flip graphqlSubs $ const Nothing
-- query and the query is then executed according to the given 'Schema'. -- query and the query is then executed according to the given 'Schema'.
-- --
-- Returns the response as an @Aeson.@'Aeson.Value'. -- Returns the response as an @Aeson.@'Aeson.Value'.
graphqlSubs :: (Alternative m, Monad m) => Schema m -> Subs -> Text -> m Aeson.Value graphqlSubs :: Alternative m => Schema m -> Subs -> Text -> m Aeson.Value
graphqlSubs schema f = graphqlSubs schema f =
either parseError (execute schema f) either parseError (execute schema f)
. Attoparsec.parseOnly document . Attoparsec.parseOnly document

View File

@ -158,7 +158,7 @@ data InterfaceTypeDefinition = InterfaceTypeDefinition Name [FieldDefinition]
data UnionTypeDefinition = UnionTypeDefinition Name [NamedType] data UnionTypeDefinition = UnionTypeDefinition Name [NamedType]
deriving (Eq,Show) deriving (Eq,Show)
data ScalarTypeDefinition = ScalarTypeDefinition Name newtype ScalarTypeDefinition = ScalarTypeDefinition Name
deriving (Eq,Show) deriving (Eq,Show)
data EnumTypeDefinition = EnumTypeDefinition Name [EnumValueDefinition] data EnumTypeDefinition = EnumTypeDefinition Name [EnumValueDefinition]

View File

@ -1,12 +1,7 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
-- | This module defines a printer for the @GraphQL@ language. -- | This module defines a printer for the @GraphQL@ language.
module Data.GraphQL.Encoder where module Data.GraphQL.Encoder where
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative ((<$>))
import Data.Monoid (Monoid, mconcat, mempty)
#endif
import Data.Monoid ((<>)) import Data.Monoid ((<>))
import Data.Text (Text, cons, intercalate, pack, snoc) import Data.Text (Text, cons, intercalate, pack, snoc)

View File

@ -1,4 +1,3 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
module Data.GraphQL.Error ( module Data.GraphQL.Error (
parseError, parseError,
@ -15,12 +14,6 @@ import Data.Text (Text, pack)
import Control.Arrow ((&&&)) import Control.Arrow ((&&&))
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative (Applicative, pure)
import Data.Foldable (Foldable, concatMap)
import Prelude hiding (concatMap)
#endif
-- | Wraps a parse error into a list of errors. -- | Wraps a parse error into a list of errors.
parseError :: Applicative f => String -> f Aeson.Value parseError :: Applicative f => String -> f Aeson.Value
parseError s = parseError s =

View File

@ -1,11 +1,7 @@
{-# LANGUAGE CPP #-}
-- | This module provides the function to execute a @GraphQL@ request -- -- | This module provides the function to execute a @GraphQL@ request --
-- according to a 'Schema'. -- according to a 'Schema'.
module Data.GraphQL.Execute (execute) where module Data.GraphQL.Execute (execute) where
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative ((<$>))
#endif
import Control.Applicative (Alternative) import Control.Applicative (Alternative)
import Data.Maybe (catMaybes) import Data.Maybe (catMaybes)

View File

@ -1,14 +1,9 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
-- | This module defines a parser for @GraphQL@ request documents. -- | This module defines a parser for @GraphQL@ request documents.
module Data.GraphQL.Parser where module Data.GraphQL.Parser where
import Prelude hiding (takeWhile) import Prelude hiding (takeWhile)
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative ((<$>), (<*>), (*>), (<*), (<$), pure)
import Data.Monoid (Monoid, mempty)
#endif
import Control.Applicative ((<|>), empty, many, optional) import Control.Applicative ((<|>), empty, many, optional)
import Control.Monad (when) import Control.Monad (when)
import Data.Char (isDigit, isSpace) import Data.Char (isDigit, isSpace)

View File

@ -1,4 +1,3 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE LambdaCase #-} {-# LANGUAGE LambdaCase #-}
-- | This module provides a representation of a @GraphQL@ Schema in addition to -- | This module provides a representation of a @GraphQL@ Schema in addition to
@ -23,16 +22,8 @@ module Data.GraphQL.Schema
, Value(..) , Value(..)
) where ) where
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative (pure)
import Control.Arrow (first)
import Data.Foldable (foldMap)
import Data.Traversable (traverse)
import Data.Monoid (Monoid(mempty,mappend))
#else
import Data.Bifunctor (first) import Data.Bifunctor (first)
import Data.Monoid (Alt(Alt,getAlt)) import Data.Monoid (Alt(Alt,getAlt))
#endif
import Control.Applicative (Alternative((<|>), empty)) import Control.Applicative (Alternative((<|>), empty))
import Data.Maybe (catMaybes) import Data.Maybe (catMaybes)
import Data.Foldable (fold) import Data.Foldable (fold)
@ -142,11 +133,3 @@ field _ = Nothing
-- | Returns a list of the 'Field's contained in the given 'SelectionSet'. -- | Returns a list of the 'Field's contained in the given 'SelectionSet'.
fields :: SelectionSet -> [Field] fields :: SelectionSet -> [Field]
fields = catMaybes . fmap field fields = catMaybes . fmap field
#if !MIN_VERSION_base(4,8,0)
newtype Alt f a = Alt {getAlt :: f a}
instance Alternative f => Monoid (Alt f a) where
mempty = Alt empty
Alt x `mappend` Alt y = Alt $ x <|> y
#endif

View File

@ -14,7 +14,7 @@ copyright: Copyright (C) 2015-2016 J. Daniel Navarro
category: Web category: Web
build-type: Simple build-type: Simple
cabal-version: >=1.10 cabal-version: >=1.10
tested-with: GHC == 7.8.4, GHC == 7.10.3 tested-with: GHC == 7.10.3, GHC==8.0.1
extra-source-files: README.md CHANGELOG.md stack.yaml extra-source-files: README.md CHANGELOG.md stack.yaml
docs/tutorial/tutorial.lhs docs/tutorial/tutorial.lhs
data-files: tests/data/*.graphql data-files: tests/data/*.graphql
@ -35,6 +35,11 @@ library
base >= 4.7 && < 5, base >= 4.7 && < 5,
text >= 0.11.3.1, text >= 0.11.3.1,
unordered-containers >= 0.2.5.0 unordered-containers >= 0.2.5.0
if impl(ghc >= 8.0)
ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances
else
-- provide/emulate `Control.Monad.Fail` and `Data.Semigroups` API for pre-GHC8
build-depends: fail == 4.9.*, semigroups == 0.18.*
test-suite tasty test-suite tasty
default-language: Haskell2010 default-language: Haskell2010