Remove deprecated functions and aliases

This commit is contained in:
Eugen Wissner 2019-10-25 09:07:45 +02:00
parent 75bc3b8509
commit 51d39b69e8
2 changed files with 4 additions and 66 deletions

View File

@ -5,14 +5,11 @@
module Language.GraphQL.AST module Language.GraphQL.AST
( Alias ( Alias
, Argument(..) , Argument(..)
, Arguments
, Definition(..) , Definition(..)
, Directive(..) , Directive(..)
, Directives
, Document , Document
, Field(..) , Field(..)
, FragmentDefinition(..) , FragmentDefinition(..)
, FragmentName
, FragmentSpread(..) , FragmentSpread(..)
, InlineFragment(..) , InlineFragment(..)
, Name , Name
@ -27,7 +24,6 @@ module Language.GraphQL.AST
, TypeCondition , TypeCondition
, Value(..) , Value(..)
, VariableDefinition(..) , VariableDefinition(..)
, VariableDefinitions
) where ) where
import Data.Int (Int32) import Data.Int (Int32)
@ -43,6 +39,9 @@ import Language.GraphQL.AST.Core ( Alias
-- | GraphQL document. -- | GraphQL document.
type Document = NonEmpty Definition type Document = NonEmpty Definition
-- | Directive.
data Directive = Directive Name [Argument] deriving (Eq, Show)
-- * Operations -- * Operations
-- | Top-level definition of a document, either an operation or a fragment. -- | Top-level definition of a document, either an operation or a fragment.
@ -88,12 +87,6 @@ data Field
= Field (Maybe Alias) Name [Argument] [Directive] SelectionSetOpt = Field (Maybe Alias) Name [Argument] [Directive] SelectionSetOpt
deriving (Eq, Show) deriving (Eq, Show)
-- * Arguments
-- | Argument list.
{-# DEPRECATED Arguments "Use [Argument] instead" #-}
type Arguments = [Argument]
-- | Argument. -- | Argument.
data Argument = Argument Name Value deriving (Eq,Show) data Argument = Argument Name Value deriving (Eq,Show)
@ -111,10 +104,7 @@ data FragmentDefinition
= FragmentDefinition Name TypeCondition [Directive] SelectionSet = FragmentDefinition Name TypeCondition [Directive] SelectionSet
deriving (Eq, Show) deriving (Eq, Show)
{-# DEPRECATED FragmentName "Use Name instead" #-} -- * Inputs
type FragmentName = Name
-- * Input values
-- | Input value. -- | Input value.
data Value = ValueVariable Name data Value = ValueVariable Name
@ -133,18 +123,10 @@ data Value = ValueVariable Name
-- A list of 'ObjectField's represents a GraphQL object type. -- A list of 'ObjectField's represents a GraphQL object type.
data ObjectField = ObjectField Name Value deriving (Eq, Show) data ObjectField = ObjectField Name Value deriving (Eq, Show)
-- * Variables
-- | Variable definition list.
{-# DEPRECATED VariableDefinitions "Use [VariableDefinition] instead" #-}
type VariableDefinitions = [VariableDefinition]
-- | Variable definition. -- | Variable definition.
data VariableDefinition = VariableDefinition Name Type (Maybe Value) data VariableDefinition = VariableDefinition Name Type (Maybe Value)
deriving (Eq, Show) deriving (Eq, Show)
-- * Input types
-- | Type representation. -- | Type representation.
data Type = TypeNamed Name data Type = TypeNamed Name
| TypeList Type | TypeList Type
@ -156,12 +138,3 @@ data Type = TypeNamed Name
data NonNullType = NonNullTypeNamed Name data NonNullType = NonNullTypeNamed Name
| NonNullTypeList Type | NonNullTypeList Type
deriving (Eq, Show) deriving (Eq, Show)
-- * Directives
-- | Directive list.
{-# DEPRECATED Directives "Use [Directive] instead" #-}
type Directives = [Directive]
-- | Directive.
data Directive = Directive Name [Argument] deriving (Eq, Show)

View File

@ -4,17 +4,12 @@
-- functions for defining and manipulating schemas. -- functions for defining and manipulating schemas.
module Language.GraphQL.Schema module Language.GraphQL.Schema
( Resolver ( Resolver
, Schema
, Subs , Subs
, object , object
, objectA , objectA
, scalar , scalar
, scalarA , scalarA
, enum
, enumA
, resolve , resolve
, wrappedEnum
, wrappedEnumA
, wrappedObject , wrappedObject
, wrappedObjectA , wrappedObjectA
, wrappedScalar , wrappedScalar
@ -29,7 +24,6 @@ import Control.Monad.IO.Class (MonadIO(..))
import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Except (runExceptT) import Control.Monad.Trans.Except (runExceptT)
import Data.Foldable (find, fold) import Data.Foldable (find, fold)
import Data.List.NonEmpty (NonEmpty)
import Data.Maybe (fromMaybe) import Data.Maybe (fromMaybe)
import qualified Data.Aeson as Aeson import qualified Data.Aeson as Aeson
import Data.HashMap.Strict (HashMap) import Data.HashMap.Strict (HashMap)
@ -41,11 +35,6 @@ import Language.GraphQL.Trans
import Language.GraphQL.Type import Language.GraphQL.Type
import Language.GraphQL.AST.Core import Language.GraphQL.AST.Core
{-# DEPRECATED Schema "Use NonEmpty (Resolver m) instead" #-}
-- | A GraphQL schema.
-- @m@ is usually expected to be an instance of 'MonadIO'.
type Schema m = NonEmpty (Resolver m)
-- | Resolves a 'Field' into an @Aeson.@'Data.Aeson.Types.Object' with error -- | Resolves a 'Field' into an @Aeson.@'Data.Aeson.Types.Object' with error
-- information (if an error has occurred). @m@ is usually expected to be an -- information (if an error has occurred). @m@ is usually expected to be an
-- instance of 'MonadIO'. -- instance of 'MonadIO'.
@ -106,30 +95,6 @@ wrappedScalar :: (MonadIO m, Aeson.ToJSON a)
=> Name -> ActionT m (Wrapping a) -> Resolver m => Name -> ActionT m (Wrapping a) -> Resolver m
wrappedScalar name = wrappedScalarA name . const wrappedScalar name = wrappedScalarA name . const
{-# DEPRECATED enum "Use scalar instead" #-}
enum :: MonadIO m => Name -> ActionT m [Text] -> Resolver m
enum name = enumA name . const
{-# DEPRECATED enumA "Use scalarA instead" #-}
enumA :: MonadIO m => Name -> ([Argument] -> ActionT m [Text]) -> Resolver m
enumA name f = Resolver name $ resolveFieldValue f resolveRight
where
resolveRight fld resolver = withField (return resolver) fld
{-# DEPRECATED wrappedEnumA "Use wrappedScalarA instead" #-}
wrappedEnumA :: MonadIO m
=> Name -> ([Argument] -> ActionT m (Wrapping [Text])) -> Resolver m
wrappedEnumA name f = Resolver name $ resolveFieldValue f resolveRight
where
resolveRight fld (Named resolver) = withField (return resolver) fld
resolveRight fld Null
= return $ HashMap.singleton (aliasOrName fld) Aeson.Null
resolveRight fld (List resolver) = withField (return resolver) fld
{-# DEPRECATED wrappedEnum "Use wrappedScalar instead" #-}
wrappedEnum :: MonadIO m => Name -> ActionT m (Wrapping [Text]) -> Resolver m
wrappedEnum name = wrappedEnumA name . const
resolveFieldValue :: MonadIO m resolveFieldValue :: MonadIO m
=> ([Argument] -> ActionT m a) => ([Argument] -> ActionT m a)
-> (Field -> a -> CollectErrsT m (HashMap Text Aeson.Value)) -> (Field -> a -> CollectErrsT m (HashMap Text Aeson.Value))