aboutsummaryrefslogtreecommitdiff
path: root/src/Language/GraphQL/AST/Document.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Language/GraphQL/AST/Document.hs')
-rw-r--r--src/Language/GraphQL/AST/Document.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Language/GraphQL/AST/Document.hs b/src/Language/GraphQL/AST/Document.hs
index a78b007..a698d2e 100644
--- a/src/Language/GraphQL/AST/Document.hs
+++ b/src/Language/GraphQL/AST/Document.hs
@@ -226,6 +226,12 @@ type TypeCondition = Name
-- ** Input Values
+-- | Escapes a single character according to the GraphQL escaping rules for
+-- double-quoted string values.
+--
+-- Characters, that should be escaped, are written as escaped characters with a
+-- backslash or Unicode with an \"\\u\". Other characters are returned as
+-- strings.
escape :: Char -> String
escape char'
| char' == '\\' = "\\\\"
@@ -257,7 +263,7 @@ data Value
| Boolean Bool
| Null
| Enum Name
- | List [Value]
+ | List [Node Value]
| Object [ObjectField Value]
deriving Eq
@@ -281,7 +287,7 @@ data ConstValue
| ConstBoolean Bool
| ConstNull
| ConstEnum Name
- | ConstList [ConstValue]
+ | ConstList [Node ConstValue]
| ConstObject [ObjectField ConstValue]
deriving Eq
@@ -318,13 +324,13 @@ instance Functor ObjectField where
-- Each operation can include a list of variables:
--
-- @
--- query (protagonist: String = "Zarathustra") {
+-- query (protagonist: String = \"Zarathustra\") {
-- getAuthor(protagonist: $protagonist)
-- }
-- @
--
-- This query defines an optional variable @protagonist@ of type @String@,
--- its default value is "Zarathustra". If no default value is defined and no
+-- its default value is \"Zarathustra\". If no default value is defined and no
-- value is provided, a variable can still be @null@ if its type is nullable.
--
-- Variables are usually passed along with the query, but not in the query