graphql-parser-0.1.0.0: GraphQL API

Copyright(c) 2018 Hasura Technologies Pvt. Ltd.
LicenseBSD3
MaintainerVamshi Surabhi <vamshi@hasura.io>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Language.GraphQL.June2018.Parser

Contents

Description

 

Synopsis

How to use this library

This module exposes functions dealing with parsing GraphQL schema and executable documents.

Parsing GraphQL executable documents

{-# LANGUAGE OverloadedStrings #-}
import qualified  Language.GraphQL.June2018.Parser as AST

main = do
  let ast = AST.parseExecutableDoc "{ cat }"
  either (fail . show) f ast
  where
    f _ = return () -- The function which uses the ast

Parsing GraphQL schema

{-# LANGUAGE OverloadedStrings #-}
import qualified  Language.GraphQL.June2018.Parser as AST

main :: do
  let schema = AST.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

value :: Parser Value Source #

Parser for GraphQL value data type.