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

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 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

value :: Parser Value Source #

Parser for GraphQL value data type.