summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Navarro <j@dannynavarro.net>2017-03-07 20:03:12 -0300
committerGitHub <noreply@github.com>2017-03-07 20:03:12 -0300
commit40f9024b51900c73bc0f65444c16022bd73820be (patch)
tree83c4d2e56491a2b6ae2c2cf2280f8c6293818fbe
parent2b5648efda40e28ae652ff6c27ac012edda0472e (diff)
parent8d21972c42f07f7bb100ce29db192147e266c561 (diff)
downloadgraphql-40f9024b51900c73bc0f65444c16022bd73820be.tar.gz
Merge pull request #22 from Lupino/master
update docs
-rw-r--r--docs/tutorial/tutorial.html7
-rw-r--r--docs/tutorial/tutorial.lhs7
-rw-r--r--docs/tutorial/tutorial.pdfbin140420 -> 140514 bytes
-rw-r--r--docs/tutorial/tutorial.rst7
4 files changed, 12 insertions, 9 deletions
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 */
<span class="kw">import qualified</span> <span class="dt">Data.GraphQL.Schema</span> <span class="kw">as</span> <span class="dt">Schema</span>
<span class="kw">import </span><span class="dt">Control.Applicative</span>
+<span class="kw">import </span><span class="dt">Data.List.NonEmpty</span> (<span class="dt">NonEmpty</span>((:|)))
<span class="kw">import </span><span class="dt">Data.Text</span> <span class="kw">hiding</span> (empty)
<span class="kw">import </span><span class="dt">Data.Aeson</span>
<span class="kw">import </span><span class="dt">Data.ByteString.Lazy.Char8</span> (putStrLn)
@@ -86,7 +87,7 @@ code > span.in { color: #008000; } /* Information */
<p>Now, as our first example, we are going to look at the example from <a href="https://github.com/graphql/graphql-js">graphql.js</a>.</p>
<p>First we build a GraphQL schema.</p>
<div class="sourceCode"><pre class="sourceCode literate haskell"><code class="sourceCode haskell"><span class="ot">schema1 ::</span> <span class="dt">Alternative</span> f <span class="ot">=&gt;</span> <span class="dt">Schema</span> f
-schema1 <span class="fu">=</span> <span class="dt">Schema</span> [hello]
+schema1 <span class="fu">=</span> hello <span class="fu">:|</span> []
<span class="ot">hello ::</span> <span class="dt">Alternative</span> f <span class="ot">=&gt;</span> <span class="dt">Resolver</span> f
hello <span class="fu">=</span> Schema.scalar <span class="st">&quot;hello&quot;</span> (<span class="st">&quot;it&#39;s me&quot;</span><span class="ot"> ::</span> <span class="dt">Text</span>)</code></pre></div>
@@ -104,7 +105,7 @@ main1 <span class="fu">=</span> putStrLn <span class="fu">=&lt;&lt;</span> encod
<h3>Monadic actions</h3>
<p>For this example, we’re going to be using time.</p>
<div class="sourceCode"><pre class="sourceCode literate haskell"><code class="sourceCode haskell"><span class="ot">schema2 ::</span> <span class="dt">Schema</span> <span class="dt">IO</span>
-schema2 <span class="fu">=</span> <span class="dt">Schema</span> [time]
+schema2 <span class="fu">=</span> time <span class="fu">:|</span> []
<span class="ot">time ::</span> <span class="dt">Resolver</span> <span class="dt">IO</span>
time <span class="fu">=</span> Schema.scalarA <span class="st">&quot;time&quot;</span> <span class="fu">$</span> \<span class="kw">case</span>
@@ -144,7 +145,7 @@ This will fail
<h3>Combining resolvers</h3>
<p>Now that we have two resolvers, we can define a schema which uses them both.</p>
<div class="sourceCode"><pre class="sourceCode literate haskell"><code class="sourceCode haskell"><span class="ot">schema3 ::</span> <span class="dt">Schema</span> <span class="dt">IO</span>
-schema3 <span class="fu">=</span> <span class="dt">Schema</span> [hello, time]
+schema3 <span class="fu">=</span> hello <span class="fu">:|</span> [time]
<span class="ot">query3 ::</span> <span class="dt">Text</span>
query3 <span class="fu">=</span> <span class="st">&quot;query timeAndHello { time hello }&quot;</span>
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
--- a/docs/tutorial/tutorial.pdf
+++ b/docs/tutorial/tutorial.pdf
Binary files 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 }"