From 63d4de485d3cd96c00480dfe2e5a6cb320d520c7 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 1 Sep 2019 02:53:15 +0200 Subject: Deprecate enum, enumA, wrappedEnum, wrappedEnumA These functions are from Language.GraphQL.Schema. There are actually only two generic types in GraphQL: Scalars and objects. Enum is a scalar value. According to the specification enums may be serailized to strings. And in the current implementation they used untyped strings anyway, so there is no point to have differently named functions with the same implementation as their scalar counterparts. --- src/Language/GraphQL/Schema.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/Language') diff --git a/src/Language/GraphQL/Schema.hs b/src/Language/GraphQL/Schema.hs index 3170a32..428b80e 100644 --- a/src/Language/GraphQL/Schema.hs +++ b/src/Language/GraphQL/Schema.hs @@ -111,18 +111,17 @@ wrappedScalar :: (MonadIO m, Aeson.ToJSON a) => Name -> ActionT m (Wrapping a) -> Resolver m wrappedScalar name = wrappedScalarA name . const --- | Represents one of a finite set of possible values. --- Used in place of a 'scalar' when the possible responses are easily enumerable. +{-# DEPRECATED enum "Use scalar instead" #-} enum :: MonadIO m => Name -> ActionT m [Text] -> Resolver m enum name = enumA name . const --- | Like 'enum' but also taking 'Argument's. +{-# DEPRECATED enumA "Use scalarA instead" #-} enumA :: MonadIO m => Name -> (Arguments -> ActionT m [Text]) -> Resolver m enumA name f = Resolver name $ resolveFieldValue f resolveRight where resolveRight fld resolver = withField (return resolver) fld --- | Like 'enum' but also taking 'Argument's and can be null or a list of enums. +{-# DEPRECATED wrappedEnumA "Use wrappedScalarA instead" #-} wrappedEnumA :: MonadIO m => Name -> (Arguments -> ActionT m (Wrapping [Text])) -> Resolver m wrappedEnumA name f = Resolver name $ resolveFieldValue f resolveRight @@ -132,7 +131,7 @@ wrappedEnumA name f = Resolver name $ resolveFieldValue f resolveRight = return $ HashMap.singleton (aliasOrName fld) Aeson.Null resolveRight fld (List resolver) = withField (return resolver) fld --- | Like 'enum' but can be null or a list of enums. +{-# DEPRECATED wrappedEnum "Use wrappedScalar instead" #-} wrappedEnum :: MonadIO m => Name -> ActionT m (Wrapping [Text]) -> Resolver m wrappedEnum name = wrappedEnumA name . const -- cgit v1.2.3