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