From c3ecfece0358d79dd1da6efbe6ab83e63bf50f88 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Thu, 21 May 2020 10:20:59 +0200 Subject: Coerce variable values --- docs/tutorial/tutorial.lhs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/tutorial/tutorial.lhs b/docs/tutorial/tutorial.lhs index afef8d0..9b04ea3 100644 --- a/docs/tutorial/tutorial.lhs +++ b/docs/tutorial/tutorial.lhs @@ -39,7 +39,9 @@ First we build a GraphQL schema. > schema1 = Schema queryType Nothing > > queryType :: ObjectType IO -> queryType = ObjectType "Query" $ Schema.resolversToMap $ hello :| [] +> queryType = ObjectType "Query" +> $ Field Nothing (ScalarOutputType string) mempty +> <$> Schema.resolversToMap (hello :| []) > > hello :: Schema.Resolver IO > hello = Schema.scalar "hello" (return ("it's me" :: Text)) @@ -72,7 +74,9 @@ For this example, we're going to be using time. > schema2 = Schema queryType2 Nothing > > queryType2 :: ObjectType IO -> queryType2 = ObjectType "Query" $ Schema.resolversToMap $ time :| [] +> queryType2 = ObjectType "Query" +> $ Field Nothing (ScalarOutputType string) mempty +> <$> Schema.resolversToMap (time :| []) > > time :: Schema.Resolver IO > time = Schema.scalar "time" $ do @@ -134,7 +138,9 @@ Now that we have two resolvers, we can define a schema which uses them both. > schema3 = Schema queryType3 Nothing > > queryType3 :: ObjectType IO -> queryType3 = ObjectType "Query" $ Schema.resolversToMap $ hello :| [time] +> queryType3 = ObjectType "Query" +> $ Field Nothing (ScalarOutputType string) mempty +> <$> Schema.resolversToMap (hello :| [time]) > > query3 :: Text > query3 = "query timeAndHello { time hello }" -- cgit v1.2.3