summaryrefslogtreecommitdiff
path: root/src/Language/GraphQL/AST/Document.hs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2020-10-04 18:51:21 +0200
committerEugen Wissner <belka@caraus.de>2020-10-05 14:51:21 +0200
commita91bc7f2d218ea2df308d3968587b60351625150 (patch)
tree3c3170437b0c903e2c63540c028c1aaa4ff35c17 /src/Language/GraphQL/AST/Document.hs
parentd5f518fe827d3d279d6c37740820f296689539e4 (diff)
downloadgraphql-a91bc7f2d218ea2df308d3968587b60351625150.tar.gz
Validate required input fields
Diffstat (limited to 'src/Language/GraphQL/AST/Document.hs')
-rw-r--r--src/Language/GraphQL/AST/Document.hs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/Language/GraphQL/AST/Document.hs b/src/Language/GraphQL/AST/Document.hs
index 489a242..b30271c 100644
--- a/src/Language/GraphQL/AST/Document.hs
+++ b/src/Language/GraphQL/AST/Document.hs
@@ -1,5 +1,7 @@
+{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE Safe #-}
-- | This module defines an abstract syntax tree for the @GraphQL@ language. It
@@ -75,10 +77,13 @@ instance Ord Location where
-- | Contains some tree node with a location.
data Node a = Node
- { value :: a
+ { node :: a
, location :: Location
} deriving (Eq, Show)
+instance Functor Node where
+ fmap f Node{..} = Node (f node) location
+
-- ** Document
-- | GraphQL document.
@@ -241,8 +246,11 @@ data ConstValue
-- | Key-value pair.
--
-- A list of 'ObjectField's represents a GraphQL object type.
-data ObjectField a = ObjectField Name a Location
- deriving (Eq, Show)
+data ObjectField a = ObjectField
+ { name :: Name
+ , value :: Node a
+ , location :: Location
+ } deriving (Eq, Show)
-- ** Variables