diff options
| author | Eugen Wissner <belka@caraus.de> | 2019-06-23 05:38:45 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2019-06-23 05:38:45 +0200 |
| commit | 2172de37296119624ba6547b66f0d5bfe0eabf9b (patch) | |
| tree | 1d6bcfa33a886b77bbb2ea7850592a881f4eeb46 | |
| parent | 5e9bf9648d891591fcb1f0e1c7b250fb80b1ddc6 (diff) | |
| download | graphql-2172de37296119624ba6547b66f0d5bfe0eabf9b.tar.gz | |
Enable mutations
| -rw-r--r-- | Data/GraphQL/Execute.hs | 10 | ||||
| -rw-r--r-- | Data/GraphQL/Parser.hs | 1 | ||||
| -rw-r--r-- | Language/GraphQL/Lexer.hs | 5 |
3 files changed, 7 insertions, 9 deletions
diff --git a/Data/GraphQL/Execute.hs b/Data/GraphQL/Execute.hs index 413a3cb..3d60bef 100644 --- a/Data/GraphQL/Execute.hs +++ b/Data/GraphQL/Execute.hs @@ -32,7 +32,9 @@ document schema (op :| []) = operation schema op document _ _ = error "Multiple operations not supported yet" operation :: Alternative f => Schema f -> AST.Core.Operation -> f Aeson.Value -operation schema (AST.Core.Query flds) = - Aeson.Object . HashMap.singleton "data" - <$> Schema.resolve (NE.toList schema) (NE.toList flds) -operation _ _ = error "Mutations not supported yet" +operation schema (AST.Core.Query flds) + = Aeson.Object . HashMap.singleton "data" + <$> Schema.resolve (NE.toList schema) (NE.toList flds) +operation schema (AST.Core.Mutation flds) + = Aeson.Object . HashMap.singleton "data" + <$> Schema.resolve (NE.toList schema) (NE.toList flds) diff --git a/Data/GraphQL/Parser.hs b/Data/GraphQL/Parser.hs index 03083d5..fc04595 100644 --- a/Data/GraphQL/Parser.hs +++ b/Data/GraphQL/Parser.hs @@ -8,7 +8,6 @@ import Control.Applicative ( Alternative(..) import Data.GraphQL.AST import Language.GraphQL.Lexer import Data.List.NonEmpty (NonEmpty(..)) -import qualified Data.Text as T import Text.Megaparsec ( lookAhead , option , try diff --git a/Language/GraphQL/Lexer.hs b/Language/GraphQL/Lexer.hs index 2d7e1aa..655be3d 100644 --- a/Language/GraphQL/Lexer.hs +++ b/Language/GraphQL/Lexer.hs @@ -38,12 +38,9 @@ import Data.List (dropWhileEnd) import Data.Proxy (Proxy(..)) import Data.Void (Void) import Text.Megaparsec ( Parsec - , MonadParsec - , Token , between , chunk , chunkToTokens - , lookAhead , notFollowedBy , oneOf , option @@ -162,7 +159,7 @@ blockString = between "\"\"\"" "\"\"\"" stringValue | not (isWhiteSpace $ T.head x) = acc | acc == 0 = T.length x | otherwise = min acc $ T.length x - removeIndent n [] = [] + removeIndent _ [] = [] removeIndent n (x:chunks) = T.drop n x : chunks -- | Parser for integers. |
