Copyright | (c) 2018 Hasura Technologies Pvt. Ltd. |
---|---|
License | BSD3 |
Maintainer | Vamshi Surabhi <vamshi@hasura.io> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
How to use this library
This module exposes functions dealing with parsing GraphQL schema and executable documents.
Parsing GraphQL executable documents
{-# LANGUAGE OverloadedStrings #-} import Language.GraphQL (parseExecutableDoc) main = do let ast = parseExecutableDoc "{ cat }" either (fail . show) f ast where f _ = return () -- The function which uses the ast
Parsing GraphQL schema
{-# LANGUAGE OverloadedStrings #-} import Language.GraphQL (parseSchemaDoc) main :: do let schema = parseSchemaDoc "type cat {name: String!}" either (fail . show) f ast where f _ = return () -- The function which uses the schema
GraphQL functions
parseExecutableDoc :: Text -> Either Text ExecutableDocument Source #
Parse an executable document into GraphQL Abstract Syntax Tree
parseSchemaDoc :: Text -> Either Text SchemaDocument Source #
Parse a schema document
Parsers
executableDocument :: Parser ExecutableDocument Source #
Parser for GraphQL Abstract Syntax Tree
schemaDocument :: Parser SchemaDocument Source #
Parser for GraphQL schema