diff options
| author | Eugen Wissner <belka@caraus.de> | 2020-05-27 23:18:35 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2020-05-29 13:53:51 +0200 |
| commit | d12577ae717512979c7654191ca65f25fc877907 (patch) | |
| tree | 17eda8d92d92ef2773c439d614f00ea0e74ea969 /docs/tutorial/tutorial.lhs | |
| parent | c06d0b8e95ea4b87eab69da085cb32dbd052c1f0 (diff) | |
| download | graphql-d12577ae717512979c7654191ca65f25fc877907.tar.gz | |
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.
Diffstat (limited to 'docs/tutorial/tutorial.lhs')
| -rw-r--r-- | docs/tutorial/tutorial.lhs | 8 |
1 files changed, 4 insertions, 4 deletions
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. |
