graphql-parser: GraphQL API

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

Warnings:

Please see the README on GitHub at https://github.com/hasura/graphql-parser-hs#readme


[Skip to ReadMe]

Properties

Version0.1.0.0
Change logChangeLog.md
Dependenciesaeson, attoparsec, base (>=4.7 && <5), containers, filepath, protolude, scientific, template-haskell, text, th-lift-instances, unordered-containers, vector [details]
LicenseBSD-3-Clause
Copyright2018 Hasura Technologies Pvt. Ltd.
AuthorVamshi Surabhi
Maintainervamshi@hasura.io
CategoryWeb
Home pagehttps://github.com/hasura/graphql-parser-hs#readme
Bug trackerhttps://github.com/hasura/graphql-parser-hs/issues
Source repositoryhead: git clone https://github.com/hasura/graphql-parser-hs
UploadedTue Aug 21 06:31:01 UTC 2018 by nizar_m

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees


Readme for graphql-parser-0.1.0.0

[back to package description]

graphql-parser

graphql-parser helps you parse the GraphQL Schema and Executable documents into Haskell data types (SchemaDocument and ExecutableDocument respectively).

Examples

Parsing GraphQL executable document

{-# 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 goes here

Parsing GraphQL schema document

{-# 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 goes here