diff options
| author | Eugen Wissner <belka@caraus.de> | 2019-06-30 06:07:32 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2019-06-30 06:07:32 +0200 |
| commit | f64e186c60a94223eb4b5a156d986a4c78c025c7 (patch) | |
| tree | aa3159e86132eacfefec98a9105ad05173c99ae1 /src/Data/GraphQL/AST/Core.hs | |
| parent | 28aaa6a70b7d8301cb94e7dc112dc292627f0ef9 (diff) | |
| download | graphql-f64e186c60a94223eb4b5a156d986a4c78c025c7.tar.gz | |
Move the source code into src/
Diffstat (limited to 'src/Data/GraphQL/AST/Core.hs')
| -rw-r--r-- | src/Data/GraphQL/AST/Core.hs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/Data/GraphQL/AST/Core.hs b/src/Data/GraphQL/AST/Core.hs new file mode 100644 index 0000000..f0c617c --- /dev/null +++ b/src/Data/GraphQL/AST/Core.hs @@ -0,0 +1,38 @@ +-- | This is the AST meant to be executed. +module Data.GraphQL.AST.Core where + +import Data.Int (Int32) +import Data.List.NonEmpty (NonEmpty) +import Data.String + +import Data.Text (Text) + +type Name = Text + +type Document = NonEmpty Operation + +data Operation = Query (NonEmpty Field) + | Mutation (NonEmpty 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 + | 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) |
