diff options
| author | solrun <solalola@gmail.com> | 2016-03-09 01:15:46 +0100 |
|---|---|---|
| committer | solrun <solalola@gmail.com> | 2016-03-14 01:42:55 +0100 |
| commit | 61d6af777897d918decc0ab8ef6456e05fccbe7b (patch) | |
| tree | de8594ed3874facf5ca8f9fe4d75f21fc5be3506 /Data/GraphQL/AST.hs | |
| parent | d1953891029a71115ee572b7b3798072cbaf2ea8 (diff) | |
| download | graphql-61d6af777897d918decc0ab8ef6456e05fccbe7b.tar.gz | |
Added documentation of functions and modules and included tutorial.lhs.
Diffstat (limited to 'Data/GraphQL/AST.hs')
| -rw-r--r-- | Data/GraphQL/AST.hs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Data/GraphQL/AST.hs b/Data/GraphQL/AST.hs index 2703a5b..5fdd146 100644 --- a/Data/GraphQL/AST.hs +++ b/Data/GraphQL/AST.hs @@ -1,3 +1,8 @@ +{- | This module defines an + abstract syntax tree for the GraphQL language, based on + <https://facebook.github.io/graphql/ Facebook's GraphQL Specification>. +-} + module Data.GraphQL.AST where import Data.Int (Int32) @@ -39,11 +44,33 @@ data Selection = SelectionField Field | SelectionInlineFragment InlineFragment deriving (Eq,Show) +{- | <https://facebook.github.io/graphql/#sec-Language.Query-Document.Fields Field Specification> + + A selection set is primarily composed of fields. + A field describes one discrete piece of information + available to request within a selection set. + + Some fields describe complex data or relationships to other data. + In order to further explore this data, a field may itself contain + a selection set, allowing for deeply nested requests. + All GraphQL operations must specify their selections down to + fields which return scalar values to ensure an unambiguously + shaped response. + +-} data Field = Field Alias Name [Argument] [Directive] SelectionSet deriving (Eq,Show) type Alias = Name +{- | <https://facebook.github.io/graphql/#sec-Language.Query-Document.Arguments Argument Specification> + + Fields are conceptually functions which return values, + and occasionally accept arguments which alter their behavior. + These arguments often map directly to function arguments within a + GraphQL server’s implementation. + +-} data Argument = Argument Name Value deriving (Eq,Show) -- * Fragments @@ -63,6 +90,18 @@ type TypeCondition = NamedType -- * Values +{- | <https://facebook.github.io/graphql/#sec-Input-Values Input Value Specification> + + Field and directive arguments accept input values + of various literal primitives; input values can be scalars, + enumeration values, lists, or input objects. + + If not defined as constant (for example, in DefaultValue), + input values can be specified as a variable. + List and inputs objects may also contain + variables (unless defined to be constant). + +-} data Value = ValueVariable Variable | ValueInt Int32 -- GraphQL Float is double precison |
