From 930b8f10b7d083132c05c8d8fe39f337eeddbeca Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Tue, 23 Nov 2021 09:21:07 +0100 Subject: [PATCH] Eta reduce and update required hlint --- src/Language/GraphQL/Type/Schema.hs | 4 ++-- src/Language/GraphQL/Validate/Rules.hs | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Language/GraphQL/Type/Schema.hs b/src/Language/GraphQL/Type/Schema.hs index ddddb4a..c8ac77a 100644 --- a/src/Language/GraphQL/Type/Schema.hs +++ b/src/Language/GraphQL/Type/Schema.hs @@ -205,5 +205,5 @@ collectImplementations = HashMap.foldr go HashMap.empty let Out.ObjectType _ _ interfaces _ = objectType in foldr (add implementation) accumulator interfaces go _ accumulator = accumulator - add implementation (Out.InterfaceType typeName _ _ _) accumulator = - HashMap.insertWith (++) typeName [implementation] accumulator + add implementation (Out.InterfaceType typeName _ _ _) = + HashMap.insertWith (++) typeName [implementation] diff --git a/src/Language/GraphQL/Validate/Rules.hs b/src/Language/GraphQL/Validate/Rules.hs index 46a14b7..d7cc395 100644 --- a/src/Language/GraphQL/Validate/Rules.hs +++ b/src/Language/GraphQL/Validate/Rules.hs @@ -152,7 +152,7 @@ singleFieldSubscriptionsRule = OperationDefinitionRule $ \case where errorMessage = "Anonymous Subscription must select only one top level field." - collectFields selectionSet = foldM forEach HashSet.empty selectionSet + collectFields = foldM forEach HashSet.empty forEach accumulator = \case Full.FieldSelection fieldSelection -> forField accumulator fieldSelection Full.FragmentSpreadSelection fragmentSelection -> @@ -472,7 +472,7 @@ noFragmentCyclesRule = FragmentDefinitionRule $ \case collectCycles :: Traversable t => t Full.Selection -> StateT (Int, Full.Name) (ReaderT (Validation m) Seq) (HashMap Full.Name Int) - collectCycles selectionSet = foldM forEach HashMap.empty selectionSet + collectCycles = foldM forEach HashMap.empty forEach accumulator = \case Full.FieldSelection fieldSelection -> forField accumulator fieldSelection Full.InlineFragmentSelection fragmentSelection -> @@ -702,8 +702,7 @@ uniqueInputFieldNamesRule = where go (Full.Node (Full.Object fields) _) = filterFieldDuplicates fields go _ = mempty - filterFieldDuplicates fields = - filterDuplicates getFieldName "input field" fields + filterFieldDuplicates = filterDuplicates getFieldName "input field" getFieldName (Full.ObjectField fieldName _ location') = (fieldName, location') constGo (Full.Node (Full.ConstObject fields) _) = filterFieldDuplicates fields constGo _ = mempty @@ -1331,8 +1330,8 @@ variablesInAllowedPositionRule = OperationDefinitionRule $ \case -> Type.CompositeType m -> t Full.Selection -> ValidationState m (Seq Error) - visitSelectionSet variables selectionType selections = - foldM (evaluateSelection variables selectionType) mempty selections + visitSelectionSet variables selectionType = + foldM (evaluateSelection variables selectionType) mempty evaluateFieldSelection variables selections accumulator = \case Just newParentType -> do let folder = evaluateSelection variables newParentType @@ -1617,4 +1616,3 @@ valuesOfCorrectTypeRule = ValueRule go constGo } | otherwise -> mempty _ -> checkResult -