summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2019-12-31 08:29:03 +0100
committerEugen Wissner <belka@caraus.de>2019-12-31 08:29:03 +0100
commitd82d5a36b32934bfeb99bf8c99637977dfe725b4 (patch)
tree97ab354a4add27238cac8a3e46384d8b74accc36 /docs
parent44dc80bb37558fc6a35b22791ac407b63956176d (diff)
downloadgraphql-d82d5a36b32934bfeb99bf8c99637977dfe725b4.tar.gz
Retrieve resolver arguments from the reader
Diffstat (limited to 'docs')
-rw-r--r--docs/tutorial/tutorial.lhs9
1 files changed, 3 insertions, 6 deletions
diff --git a/docs/tutorial/tutorial.lhs b/docs/tutorial/tutorial.lhs
index d017ddd..fcbc3eb 100644
--- a/docs/tutorial/tutorial.lhs
+++ b/docs/tutorial/tutorial.lhs
@@ -16,7 +16,6 @@ Since this file is a literate haskell file, we start by importing some dependenc
> module Main where
>
> import Control.Monad.IO.Class (liftIO)
-> import Control.Monad.Trans.Except (throwE)
> import Data.Aeson (encode)
> import Data.ByteString.Lazy.Char8 (putStrLn)
> import Data.List.NonEmpty (NonEmpty(..))
@@ -25,7 +24,6 @@ Since this file is a literate haskell file, we start by importing some dependenc
>
> import Language.GraphQL
> import qualified Language.GraphQL.Schema as Schema
-> import Language.GraphQL.Trans (ActionT(..))
>
> import Prelude hiding (putStrLn)
@@ -70,10 +68,9 @@ For this example, we're going to be using time.
> schema2 = time :| []
>
> time :: Schema.Resolver IO
-> time = Schema.scalarA "time" $ \case
-> [] -> do t <- liftIO getCurrentTime
-> return $ show t
-> _ -> ActionT $ throwE "Invalid arguments."
+> time = Schema.scalar "time" $ do
+> t <- liftIO getCurrentTime
+> return $ show t
This defines a simple schema with one type and one field,
which resolves to the current time.