diff options
Diffstat (limited to 'docs/tutorial/tutorial.lhs')
| -rw-r--r-- | docs/tutorial/tutorial.lhs | 12 |
1 files changed, 9 insertions, 3 deletions
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 }" |
