summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2020-01-12 07:19:28 +0100
committerEugen Wissner <belka@caraus.de>2020-01-12 07:19:28 +0100
commit6d951491be0093f7568462a3139115cdab6766ed (patch)
tree556b96becdd9f45aa2e9632af53a4a8e60884d84
parentdd8f312cb3b0478a3f1e6215c73f47d49180be65 (diff)
downloadgraphql-6d951491be0093f7568462a3139115cdab6766ed.tar.gz
Replace Parser.manyNE with NonEmpty.some
-rw-r--r--docs/tutorial/tutorial.lhs1
-rw-r--r--package.yaml1
-rw-r--r--src/Language/GraphQL/AST/Parser.hs9
-rw-r--r--stack.yaml2
4 files changed, 5 insertions, 8 deletions
diff --git a/docs/tutorial/tutorial.lhs b/docs/tutorial/tutorial.lhs
index fcbc3eb..a10f861 100644
--- a/docs/tutorial/tutorial.lhs
+++ b/docs/tutorial/tutorial.lhs
@@ -12,7 +12,6 @@ We have written a small tutorial to help you (and ourselves) understand the grap
Since this file is a literate haskell file, we start by importing some dependencies.
> {-# LANGUAGE OverloadedStrings #-}
-> {-# LANGUAGE LambdaCase #-}
> module Main where
>
> import Control.Monad.IO.Class (liftIO)
diff --git a/package.yaml b/package.yaml
index aaf496c..a45c040 100644
--- a/package.yaml
+++ b/package.yaml
@@ -30,6 +30,7 @@ dependencies:
- base >= 4.7 && < 5
- containers
- megaparsec
+- parser-combinators
- text
- transformers
- unordered-containers
diff --git a/src/Language/GraphQL/AST/Parser.hs b/src/Language/GraphQL/AST/Parser.hs
index 113b0a4..8268687 100644
--- a/src/Language/GraphQL/AST/Parser.hs
+++ b/src/Language/GraphQL/AST/Parser.hs
@@ -7,7 +7,7 @@ module Language.GraphQL.AST.Parser
) where
import Control.Applicative (Alternative(..), optional)
-import Data.List.NonEmpty (NonEmpty(..))
+import qualified Control.Applicative.Combinators.NonEmpty as NonEmpty
import Language.GraphQL.AST
import qualified Language.GraphQL.AST.Document as Document
import Language.GraphQL.AST.Lexer
@@ -17,7 +17,7 @@ import Text.Megaparsec (lookAhead, option, try, (<?>))
document :: Parser Document.Document
document = unicodeBOM
>> spaceConsumer
- >> lexeme (manyNE $ Document.ExecutableDefinition <$> definition)
+ >> lexeme (NonEmpty.some $ Document.ExecutableDefinition <$> definition)
definition :: Parser ExecutableDefinition
definition = DefinitionOperation <$> operationDefinition
@@ -44,7 +44,7 @@ operationType = Query <$ symbol "query"
-- * SelectionSet
selectionSet :: Parser SelectionSet
-selectionSet = braces $ manyNE selection
+selectionSet = braces $ NonEmpty.some selection
selectionSetOpt :: Parser SelectionSetOpt
selectionSetOpt = braces $ some selection
@@ -186,6 +186,3 @@ but :: Parser a -> Parser ()
but pn = False <$ lookAhead pn <|> pure True >>= \case
False -> empty
True -> pure ()
-
-manyNE :: Alternative f => f a -> f (NonEmpty a)
-manyNE p = (:|) <$> p <*> many p
diff --git a/stack.yaml b/stack.yaml
index 2155a49..a958e3c 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -1,4 +1,4 @@
-resolver: lts-14.19
+resolver: lts-14.20
packages:
- .