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 }"
diff --git a/docs/tutorial/tutorial.lhs b/docs/tutorial/tutorial.lhs
index 387d14d..7c534c4 100644
--- a/docs/tutorial/tutorial.lhs
+++ b/docs/tutorial/tutorial.lhs
@@ -21,6 +21,7 @@ Since this file is a literate haskell file, we start by importing some dependenc
 > 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)
@@ -37,7 +38,7 @@ example from [graphql.js](https://github.com/graphql/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)
@@ -67,7 +68,7 @@ returning
 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
@@ -127,7 +128,7 @@ This will fail
 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 }"
diff --git a/docs/tutorial/tutorial.pdf b/docs/tutorial/tutorial.pdf
index 6295ee8..cfe4434 100644
Binary files a/docs/tutorial/tutorial.pdf and b/docs/tutorial/tutorial.pdf differ
diff --git a/docs/tutorial/tutorial.rst b/docs/tutorial/tutorial.rst
index 1c8b5ff..48fc29f 100644
--- a/docs/tutorial/tutorial.rst
+++ b/docs/tutorial/tutorial.rst
@@ -29,6 +29,7 @@ dependencies.
     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)
@@ -48,7 +49,7 @@ First we build a GraphQL schema.
 .. code:: haskell
 
     schema1 :: Alternative f => Schema f
-    schema1 = Schema [hello]
+    schema1 = hello :| []
 
     hello :: Alternative f => Resolver f
     hello = Schema.scalar "hello" ("it's me" :: Text)
@@ -82,7 +83,7 @@ For this example, we're going to be using time.
 .. code:: haskell
 
     schema2 :: Schema IO
-    schema2 = Schema [time]
+    schema2 = time :| []
 
     time :: Resolver IO
     time = Schema.scalarA "time" $ \case
@@ -150,7 +151,7 @@ both.
 .. code:: haskell
 
     schema3 :: Schema IO
-    schema3 = Schema [hello, time]
+    schema3 = hello :| [time]
 
     query3 :: Text
     query3 = "query timeAndHello { time hello }"