summaryrefslogtreecommitdiff
path: root/docs/tutorial
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2020-06-13 07:20:19 +0200
committerEugen Wissner <belka@caraus.de>2020-06-13 07:20:19 +0200
commit882276a845c33c06b235d9604cbfd5b55d784c7d (patch)
treef6a4e9af38ae6772fa2ae49bb22e565996d1d06e /docs/tutorial
parente8c54810f8978b29e136ac0e1d91db8545a3f5f5 (diff)
downloadgraphql-882276a845c33c06b235d9604cbfd5b55d784c7d.tar.gz
Coerce result
Fixes #45.
Diffstat (limited to 'docs/tutorial')
-rw-r--r--docs/tutorial/tutorial.lhs6
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/tutorial/tutorial.lhs b/docs/tutorial/tutorial.lhs
index 9a2242e..13afb81 100644
--- a/docs/tutorial/tutorial.lhs
+++ b/docs/tutorial/tutorial.lhs
@@ -61,7 +61,7 @@ Next we define our query.
To run the query, we call the `graphql` with the schema and the query.
> main1 :: IO ()
-> main1 = putStrLn =<< encode <$> graphql schema1 query1
+> main1 = graphql schema1 query1 >>= putStrLn . encode
This runs the query by fetching the one field defined,
returning
@@ -99,7 +99,7 @@ Next we define our query.
> query2 = "{ time }"
>
> main2 :: IO ()
-> main2 = putStrLn =<< encode <$> graphql schema2 query2
+> main2 = graphql schema2 query2 >>= putStrLn . encode
This runs the query, returning the current time
@@ -154,7 +154,7 @@ Now that we have two resolvers, we can define a schema which uses them both.
> query3 = "query timeAndHello { time hello }"
>
> main3 :: IO ()
-> main3 = putStrLn =<< encode <$> graphql schema3 query3
+> main3 = graphql schema3 query3 >>= putStrLn . encode
This queries for both time and hello, returning