summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2020-07-19 07:36:06 +0200
committerEugen Wissner <belka@caraus.de>2020-07-19 07:36:06 +0200
commitb9d5b1fb1bdf634137f463186585bc51e540353b (patch)
tree26b37de5a9f6592e8faaf97c11050c3661e734bf /docs
parent09135c581aaae471f7d964bc2a3a141bef299097 (diff)
downloadgraphql-b9d5b1fb1bdf634137f463186585bc51e540353b.tar.gz
Return a stream as well from graphql* functions
Diffstat (limited to 'docs')
-rw-r--r--docs/tutorial/tutorial.lhs9
1 files changed, 6 insertions, 3 deletions
diff --git a/docs/tutorial/tutorial.lhs b/docs/tutorial/tutorial.lhs
index 00ad98d..dc44c1e 100644
--- a/docs/tutorial/tutorial.lhs
+++ b/docs/tutorial/tutorial.lhs
@@ -64,7 +64,8 @@ Next we define our query.
To run the query, we call the `graphql` with the schema and the query.
> main1 :: IO ()
-> main1 = graphql schema1 query1 >>= putStrLn . encode
+> main1 = graphql schema1 query1
+> >>= either (const $ pure ()) (putStrLn . encode)
This runs the query by fetching the one field defined, returning
@@ -101,7 +102,8 @@ Next we define our query.
> query2 = "{ time }"
>
> main2 :: IO ()
-> main2 = graphql schema2 query2 >>= putStrLn . encode
+> main2 = graphql schema2 query2
+> >>= either (const $ pure ()) (putStrLn . encode)
This runs the query, returning the current time
@@ -126,7 +128,8 @@ Now that we have two resolvers, we can define a schema which uses them both.
> query3 = "query timeAndHello { time hello }"
>
> main3 :: IO ()
-> main3 = graphql schema3 query3 >>= putStrLn . encode
+> main3 = graphql schema3 query3
+> >>= either (const $ pure ()) (putStrLn . encode)
This queries for both time and hello, returning