@@ -90,13 +90,13 @@ module Ast =
9090 type MetaTypeFieldInfo = { Name : string ; ArgumentNames : string [] }
9191
9292 let private metaTypeFields =
93- [|
93+ seq {
9494 { Name = " __type" ; ArgumentNames = [| " name" |] }
9595 { Name = " __schema" ; ArgumentNames = [||] }
9696 { Name = " __typename" ; ArgumentNames = [||] }
97- |]
98- |> Array .map ( fun x -> x.Name, x)
99- |> Map.ofArray
97+ }
98+ |> Seq .map ( fun x -> x.Name, x)
99+ |> Map.ofSeq
100100
101101 let rec private tryGetSchemaTypeByRef ( schemaTypes : Map < string , IntrospectionType >) ( tref : IntrospectionTypeRef ) =
102102 match tref.Kind with
@@ -436,8 +436,8 @@ module Ast =
436436 AstError.AsResult $" Operation '%s {name}' has %i {count} definitions. Each operation name must be unique." )
437437
438438 let internal validateLoneAnonymousOperation ( ctx : ValidationContext ) =
439- let operations = ctx.OperationDefinitions |> List.map ( fun x -> x .Definition)
440- let unamed = operations |> List.filter ( fun x -> x .Name.IsNone)
439+ let operations = ctx.OperationDefinitions |> List.map _ . Definition
440+ let unamed = operations |> List.filter _ . Name.IsNone
441441 if unamed.Length = 0 then
442442 Success
443443 elif unamed.Length = 1 && operations.Length = 1 then
@@ -529,7 +529,7 @@ module Ast =
529529 )
530530
531531 let rec private fieldsInSetCanMerge ( set : SelectionInfo list ) =
532- let fieldsForName = set |> List.groupBy ( fun x -> x .AliasOrName)
532+ let fieldsForName = set |> List.groupBy _ . AliasOrName
533533 fieldsForName
534534 |> ValidationResult.collect ( fun ( aliasOrName , selectionSet ) ->
535535 if selectionSet.Length < 2 then
@@ -596,8 +596,9 @@ module Ast =
596596 |> ValidationResult.collect ( fun arg ->
597597 let schemaArgumentNames =
598598 metaTypeFields.TryFind ( selection.Field.Name)
599- |> Option.map ( fun x -> x.ArgumentNames)
600- |> Option.defaultValue ( selection.InputValues |> Array.map ( fun x -> x.Name))
599+ |> ValueOption.ofOption
600+ |> ValueOption.map _. ArgumentNames
601+ |> ValueOption.defaultWith ( fun () -> selection.InputValues |> Array.map _. Name)
601602 match schemaArgumentNames |> Array.tryFind ( fun x -> x = arg.Name) with
602603 | Some _ -> Success
603604 | None ->
@@ -633,7 +634,7 @@ module Ast =
633634 let rec private validateArgumentUniquenessInSelection ( selection : SelectionInfo ) =
634635 let validateArgs ( fieldOrDirective : string ) ( path : FieldPath ) ( args : Argument list ) =
635636 args
636- |> List.countBy ( fun x -> x .Name)
637+ |> List.countBy _ . Name
637638 |> ValidationResult.collect ( fun ( name , length ) ->
638639 if length > 1 then
639640 AstError.AsResult (
@@ -1019,7 +1020,7 @@ module Ast =
10191020 match selection with
10201021 | Field field ->
10211022 let path = box field.AliasOrName :: path
1022- let fieldDirectives = [ path, field.Directives |> List .map ( fun x -> x .Name) |> Set.ofList ]
1023+ let fieldDirectives = [ path, field.Directives |> Seq .map _ . Name |> Set.ofSeq ]
10231024 let selectionSetDirectives =
10241025 field.SelectionSet
10251026 |> List.collect ( getDistinctDirectiveNamesInSelection path)
@@ -1028,12 +1029,12 @@ module Ast =
10281029 | FragmentSpread spread -> [
10291030 path,
10301031 spread.Directives
1031- |> List .map ( fun x -> x .Name)
1032- |> Set.ofList
1032+ |> Seq .map _ . Name
1033+ |> Set.ofSeq
10331034 ]
10341035
10351036 and private getDistinctDirectiveNamesInDefinition ( path : FieldPath ) ( frag : Definition ) : ( FieldPath * Set < string >) list =
1036- let fragDirectives = [ path, frag.Directives |> List .map ( fun x -> x .Name) |> Set.ofList ]
1037+ let fragDirectives = [ path, frag.Directives |> Seq .map _ . Name |> Set.ofSeq ]
10371038 let selectionSetDirectives =
10381039 frag.SelectionSet
10391040 |> List.collect ( getDistinctDirectiveNamesInSelection path)
@@ -1172,7 +1173,7 @@ module Ast =
11721173 directivesValid @@ directivesValidInSelectionSet
11731174
11741175 let internal validateDirectivesAreInValidLocations ( ctx : ValidationContext ) =
1175- let fragmentDefinitions = ctx.FragmentDefinitions |> List.map ( fun x -> x .Definition)
1176+ let fragmentDefinitions = ctx.FragmentDefinitions |> List.map _ . Definition
11761177 ctx.Document.Definitions
11771178 |> ValidationResult.collect ( fun def ->
11781179 let path = def.Name |> ValueOption.map box |> ValueOption.toList
@@ -1194,16 +1195,16 @@ module Ast =
11941195 match selection with
11951196 | Field field ->
11961197 let path = box field.AliasOrName :: path
1197- let fieldDirectives = [ path, field.Directives |> List.map ( fun x -> x .Name) ]
1198+ let fieldDirectives = [ path, field.Directives |> List.map _ . Name ]
11981199 let selectionSetDirectives =
11991200 field.SelectionSet
12001201 |> List.collect ( getDirectiveNamesInSelection path)
12011202 fieldDirectives |> List.append selectionSetDirectives
12021203 | InlineFragment frag -> getDirectiveNamesInDefinition path ( FragmentDefinition frag)
1203- | FragmentSpread spread -> [ path, spread.Directives |> List.map ( fun x -> x .Name) ]
1204+ | FragmentSpread spread -> [ path, spread.Directives |> List.map _ . Name ]
12041205
12051206 and private getDirectiveNamesInDefinition ( path : FieldPath ) ( frag : Definition ) : ( FieldPath * string list ) list =
1206- let fragDirectives = [ path, frag.Directives |> List.map ( fun x -> x .Name) ]
1207+ let fragDirectives = [ path, frag.Directives |> List.map _ . Name ]
12071208 let selectionSetDirectives =
12081209 frag.SelectionSet
12091210 |> List.collect ( getDirectiveNamesInSelection path)
@@ -1216,14 +1217,14 @@ module Ast =
12161217 match def.Name with
12171218 | ValueSome name -> [ box name ]
12181219 | ValueNone -> []
1219- let defDirectives = path, def.Directives |> List.map ( fun x -> x .Name)
1220+ let defDirectives = path, def.Directives |> List.map _ . Name
12201221 let selectionSetDirectives =
12211222 def.Definition.SelectionSet
12221223 |> List.collect ( getDirectiveNamesInSelection path)
12231224 defDirectives :: selectionSetDirectives)
12241225 |> ValidationResult.collect ( fun ( path , directives ) ->
12251226 directives
1226- |> List .countBy id
1227+ |> Seq .countBy id
12271228 |> ValidationResult.collect ( fun ( name , count ) ->
12281229 if count <= 1 then
12291230 Success
@@ -1324,8 +1325,8 @@ module Ast =
13241325 let path = def.Name |> ValueOption.map box |> ValueOption.toList
13251326 let varNames =
13261327 def.VariableDefinitions
1327- |> List .map ( fun x -> x .VariableName)
1328- |> Set.ofList
1328+ |> Seq .map _ . VariableName
1329+ |> Set.ofSeq
13291330 def.SelectionSet
13301331 |> ValidationResult.collect ( checkVariablesDefinedInSelection fragmentDefinitions varNames path)
13311332 | _ -> Success)
@@ -1338,7 +1339,7 @@ module Ast =
13381339 | ObjectValue obj -> go ( Map.toList obj |> List.map snd)
13391340 | ListValue xs -> go xs
13401341 | _ -> false )
1341- go ( args |> List.map ( fun x -> x .Value) )
1342+ go ( args |> List.map _ . Value)
13421343
13431344 let rec private variableIsUsedInFragmentSpread
13441345 ( name : string )
0 commit comments