From 8d21972c42f07f7bb100ce29db192147e266c561 Mon Sep 17 00:00:00 2001 From: Lupino Date: Sun, 5 Mar 2017 11:01:07 +0800 Subject: update docs --- docs/tutorial/tutorial.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'docs/tutorial/tutorial.html') diff --git a/docs/tutorial/tutorial.html b/docs/tutorial/tutorial.html index fab66c2..cbec66d 100644 --- a/docs/tutorial/tutorial.html +++ b/docs/tutorial/tutorial.html @@ -74,6 +74,7 @@ code > span.in { color: #008000; } /* Information */ import qualified Data.GraphQL.Schema as Schema import Control.Applicative +import Data.List.NonEmpty (NonEmpty((:|))) import Data.Text hiding (empty) import Data.Aeson import Data.ByteString.Lazy.Char8 (putStrLn) @@ -86,7 +87,7 @@ code > span.in { color: #008000; } /* Information */

Now, as our first example, we are going to look at the example from graphql.js.

First we build a GraphQL schema.

schema1 :: Alternative f => Schema f
-schema1 = Schema [hello]
+schema1 = hello :| []
 
 hello :: Alternative f => Resolver f
 hello = Schema.scalar "hello" ("it's me" :: Text)
@@ -104,7 +105,7 @@ main1 = putStrLn =<< encod

Monadic actions

For this example, we’re going to be using time.

schema2 :: Schema IO
-schema2 = Schema [time]
+schema2 = time :| []
 
 time :: Resolver IO
 time = Schema.scalarA "time" $ \case
@@ -144,7 +145,7 @@ This will fail
 

Combining resolvers

Now that we have two resolvers, we can define a schema which uses them both.

schema3 :: Schema IO
-schema3 = Schema [hello, time]
+schema3 = hello :| [time]
 
 query3 :: Text
 query3 = "query timeAndHello { time hello }"
-- 
cgit v1.2.3