diff options
| author | Danny Navarro <j@dannynavarro.net> | 2017-02-26 16:07:00 -0300 |
|---|---|---|
| committer | Danny Navarro <j@dannynavarro.net> | 2017-02-28 16:07:00 -0300 |
| commit | 1b8fca3658215c69402e2bc0f0c46d28e46d70e2 (patch) | |
| tree | e3d2c3760c6ec720c3a1a60b3ca7cacc74f2e331 /Data/GraphQL/AST/Core.hs | |
| parent | 642eab312f7b18619ff24e07a8863591f13ba07f (diff) | |
| parent | bada28ce24dcd0fcae95ebd7dd9a9ebb106e3842 (diff) | |
| download | graphql-1b8fca3658215c69402e2bc0f0c46d28e46d70e2.tar.gz | |
Merge branch 'core'
This introduces a distinction between a Full and a Core AST. Fragments and
variables are replaced when transforming from Full to Core.
Diffstat (limited to 'Data/GraphQL/AST/Core.hs')
| -rw-r--r-- | Data/GraphQL/AST/Core.hs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Data/GraphQL/AST/Core.hs b/Data/GraphQL/AST/Core.hs index 2ca3928..f0c617c 100644 --- a/Data/GraphQL/AST/Core.hs +++ b/Data/GraphQL/AST/Core.hs @@ -3,29 +3,36 @@ module Data.GraphQL.AST.Core where import Data.Int (Int32) import Data.List.NonEmpty (NonEmpty) +import Data.String import Data.Text (Text) -newtype Name = Name Text deriving (Eq,Show) +type Name = Text -newtype Document = Document (NonEmpty Operation) deriving (Eq,Show) +type Document = NonEmpty Operation -data Operation = Query (NonEmpty Field) +data Operation = Query (NonEmpty Field) | Mutation (NonEmpty Field) deriving (Eq,Show) -data Field = Field Name [Argument] [Field] deriving (Eq,Show) +data Field = Field (Maybe Alias) Name [Argument] [Field] deriving (Eq,Show) + +type Alias = Name data Argument = Argument Name Value deriving (Eq,Show) data Value = ValueInt Int32 -- GraphQL Float is double precision | ValueFloat Double - | ValueBoolean Bool | ValueString Text + | ValueBoolean Bool + | ValueNull | ValueEnum Name | ValueList [Value] | ValueObject [ObjectField] deriving (Eq,Show) +instance IsString Value where + fromString = ValueString . fromString + data ObjectField = ObjectField Name Value deriving (Eq,Show) |
