summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2019-09-01 02:53:15 +0200
committerEugen Wissner <belka@caraus.de>2019-09-01 03:16:27 +0200
commit63d4de485d3cd96c00480dfe2e5a6cb320d520c7 (patch)
treec24e192b68c2abbfd1db34eb576b866b01cdbb03 /src
parent22313d05df7d96cd8106bc42f787bc74d74596de (diff)
downloadgraphql-63d4de485d3cd96c00480dfe2e5a6cb320d520c7.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/Language/GraphQL/Schema.hs9
1 files changed, 4 insertions, 5 deletions
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