From d12577ae717512979c7654191ca65f25fc877907 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Wed, 27 May 2020 23:18:35 +0200 Subject: Define resolvers on type fields Returning resolvers from other resolvers isn't supported anymore. Since we have a type system now, we define the resolvers in the object type fields and pass an object with the previous result to them. --- docs/tutorial/tutorial.lhs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs/tutorial/tutorial.lhs') diff --git a/docs/tutorial/tutorial.lhs b/docs/tutorial/tutorial.lhs index 39e151c..9ca2db0 100644 --- a/docs/tutorial/tutorial.lhs +++ b/docs/tutorial/tutorial.lhs @@ -44,8 +44,8 @@ First we build a GraphQL schema. > $ HashMap.singleton "hello" > $ Field Nothing (Out.NamedScalarType string) mempty hello > -> hello :: ActionT IO (Out.Value IO) -> hello = pure $ Out.String "it's me" +> hello :: ActionT IO Value +> hello = pure $ String "it's me" This defines a simple schema with one type and one field, that resolves to a fixed value. @@ -79,10 +79,10 @@ For this example, we're going to be using time. > $ HashMap.singleton "time" > $ Field Nothing (Out.NamedScalarType string) mempty time > -> time :: ActionT IO (Out.Value IO) +> time :: ActionT IO Value > time = do > t <- liftIO getCurrentTime -> pure $ Out.String $ Text.pack $ show t +> pure $ String $ Text.pack $ show t This defines a simple schema with one type and one field, which resolves to the current time. -- cgit v1.2.3