forked from OSS/graphql
Eta reduce and update required hlint
This commit is contained in:
parent
0047a13bc0
commit
930b8f10b7
@ -205,5 +205,5 @@ collectImplementations = HashMap.foldr go HashMap.empty
|
|||||||
let Out.ObjectType _ _ interfaces _ = objectType
|
let Out.ObjectType _ _ interfaces _ = objectType
|
||||||
in foldr (add implementation) accumulator interfaces
|
in foldr (add implementation) accumulator interfaces
|
||||||
go _ accumulator = accumulator
|
go _ accumulator = accumulator
|
||||||
add implementation (Out.InterfaceType typeName _ _ _) accumulator =
|
add implementation (Out.InterfaceType typeName _ _ _) =
|
||||||
HashMap.insertWith (++) typeName [implementation] accumulator
|
HashMap.insertWith (++) typeName [implementation]
|
||||||
|
@ -152,7 +152,7 @@ singleFieldSubscriptionsRule = OperationDefinitionRule $ \case
|
|||||||
where
|
where
|
||||||
errorMessage =
|
errorMessage =
|
||||||
"Anonymous Subscription must select only one top level field."
|
"Anonymous Subscription must select only one top level field."
|
||||||
collectFields selectionSet = foldM forEach HashSet.empty selectionSet
|
collectFields = foldM forEach HashSet.empty
|
||||||
forEach accumulator = \case
|
forEach accumulator = \case
|
||||||
Full.FieldSelection fieldSelection -> forField accumulator fieldSelection
|
Full.FieldSelection fieldSelection -> forField accumulator fieldSelection
|
||||||
Full.FragmentSpreadSelection fragmentSelection ->
|
Full.FragmentSpreadSelection fragmentSelection ->
|
||||||
@ -472,7 +472,7 @@ noFragmentCyclesRule = FragmentDefinitionRule $ \case
|
|||||||
collectCycles :: Traversable t
|
collectCycles :: Traversable t
|
||||||
=> t Full.Selection
|
=> t Full.Selection
|
||||||
-> StateT (Int, Full.Name) (ReaderT (Validation m) Seq) (HashMap Full.Name Int)
|
-> 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
|
forEach accumulator = \case
|
||||||
Full.FieldSelection fieldSelection -> forField accumulator fieldSelection
|
Full.FieldSelection fieldSelection -> forField accumulator fieldSelection
|
||||||
Full.InlineFragmentSelection fragmentSelection ->
|
Full.InlineFragmentSelection fragmentSelection ->
|
||||||
@ -702,8 +702,7 @@ uniqueInputFieldNamesRule =
|
|||||||
where
|
where
|
||||||
go (Full.Node (Full.Object fields) _) = filterFieldDuplicates fields
|
go (Full.Node (Full.Object fields) _) = filterFieldDuplicates fields
|
||||||
go _ = mempty
|
go _ = mempty
|
||||||
filterFieldDuplicates fields =
|
filterFieldDuplicates = filterDuplicates getFieldName "input field"
|
||||||
filterDuplicates getFieldName "input field" fields
|
|
||||||
getFieldName (Full.ObjectField fieldName _ location') = (fieldName, location')
|
getFieldName (Full.ObjectField fieldName _ location') = (fieldName, location')
|
||||||
constGo (Full.Node (Full.ConstObject fields) _) = filterFieldDuplicates fields
|
constGo (Full.Node (Full.ConstObject fields) _) = filterFieldDuplicates fields
|
||||||
constGo _ = mempty
|
constGo _ = mempty
|
||||||
@ -1331,8 +1330,8 @@ variablesInAllowedPositionRule = OperationDefinitionRule $ \case
|
|||||||
-> Type.CompositeType m
|
-> Type.CompositeType m
|
||||||
-> t Full.Selection
|
-> t Full.Selection
|
||||||
-> ValidationState m (Seq Error)
|
-> ValidationState m (Seq Error)
|
||||||
visitSelectionSet variables selectionType selections =
|
visitSelectionSet variables selectionType =
|
||||||
foldM (evaluateSelection variables selectionType) mempty selections
|
foldM (evaluateSelection variables selectionType) mempty
|
||||||
evaluateFieldSelection variables selections accumulator = \case
|
evaluateFieldSelection variables selections accumulator = \case
|
||||||
Just newParentType -> do
|
Just newParentType -> do
|
||||||
let folder = evaluateSelection variables newParentType
|
let folder = evaluateSelection variables newParentType
|
||||||
@ -1617,4 +1616,3 @@ valuesOfCorrectTypeRule = ValueRule go constGo
|
|||||||
}
|
}
|
||||||
| otherwise -> mempty
|
| otherwise -> mempty
|
||||||
_ -> checkResult
|
_ -> checkResult
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user