diff options
| author | Eugen Wissner <belka@caraus.de> | 2019-07-07 06:31:53 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2019-07-07 06:31:53 +0200 |
| commit | 22d4a4e583d8075fc71cddc22566f41fc5a698dc (patch) | |
| tree | 116b444d7b465aadf8a33a22fdd2a6db6994e7c0 /src/Language/GraphQL/AST/Core.hs | |
| parent | 1431db7e634e5447375e1c598f4336f499384730 (diff) | |
| download | graphql-22d4a4e583d8075fc71cddc22566f41fc5a698dc.tar.gz | |
Change the main namespace to Language.GraphQL
Diffstat (limited to 'src/Language/GraphQL/AST/Core.hs')
| -rw-r--r-- | src/Language/GraphQL/AST/Core.hs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/Language/GraphQL/AST/Core.hs b/src/Language/GraphQL/AST/Core.hs new file mode 100644 index 0000000..be432a8 --- /dev/null +++ b/src/Language/GraphQL/AST/Core.hs @@ -0,0 +1,38 @@ +-- | This is the AST meant to be executed. +module Language.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) |
