Skip to content

Commit 023790c

Browse files
committed
Migrated to underscore property access lambda syntax
1 parent 3777705 commit 023790c

File tree

10 files changed

+14
-14
lines changed

10 files changed

+14
-14
lines changed

samples/relay-book-store/Schema.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,14 @@ let booksField =
159159
let startCursor = async {
160160
let! edges = edges
161161

162-
return edges |> Seq.tryHead |> Option.map (fun x -> x.Cursor)
162+
return edges |> Seq.tryHead |> Option.map _.Cursor
163163
}
164164

165165
// The cursor of the last edge
166166
let endCursor = async {
167167
let! edges = edges
168168

169-
return edges |> Seq.tryLast |> Option.map (fun x -> x.Cursor)
169+
return edges |> Seq.tryLast |> Option.map _.Cursor
170170
}
171171

172172
{

src/FSharp.Data.GraphQL.Client.DesignTime/GraphQLProvider.DesignTime.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ type GraphQLTypeProvider (config) as this =
2626
if args.Name.Contains("FSharp.Data.GraphQL") then
2727
printfn "ResolveAssembly: %s" args.Name
2828
config.ReferencedAssemblies
29-
|> Array.filter(fun x -> x.Contains("FSharp.Data"))
30-
|> Array.iter (fun x -> printfn "%s" x)
29+
|> Array.filter _.Contains("FSharp.Data")
30+
|> Array.iter (fun x -> printfn "%s" x)
3131
base.ResolveAssembly args
3232

3333
[<assembly:TypeProviderAssembly>]

src/FSharp.Data.GraphQL.Client.DesignTime/ProvidedTypesHelper.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ module internal ProvidedRecord =
184184
|> List.partition (fun (_, t) -> isOption t)
185185
if explicitOptionalParameters then
186186
let constructorProperties = requiredProperties @ optionalProperties
187-
let propertyNames = constructorProperties |> List.map (fst >> (fun x -> x.FirstCharUpper()))
187+
let propertyNames = constructorProperties |> List.map (fst >> _.FirstCharUpper())
188188
let constructorPropertyTypes = constructorProperties |> List.map snd
189189
let invoker (args : Expr list) =
190190
let properties =
@@ -208,7 +208,7 @@ module internal ProvidedRecord =
208208
List.combinations optionalProperties
209209
|> List.map (fun (optionalProperties, nullValuedProperties) ->
210210
let constructorProperties = requiredProperties @ optionalProperties
211-
let propertyNames = (constructorProperties @ nullValuedProperties) |> List.map (fst >> (fun x -> x.FirstCharUpper()))
211+
let propertyNames = (constructorProperties @ nullValuedProperties) |> List.map (fst >> _.FirstCharUpper())
212212
let constructorPropertyTypes = constructorProperties |> List.map snd
213213
let nullValuedPropertyTypes = nullValuedProperties |> List.map snd
214214
let invoker (args : Expr list) =
@@ -554,7 +554,7 @@ module internal Provider =
554554
| TypeField _ -> Some x
555555
| FragmentField f when f.TypeCondition = tref.Name.Value -> Some x
556556
| _ -> None)
557-
|> List.distinctBy (fun x -> x.AliasOrName)
557+
|> List.distinctBy _.AliasOrName
558558
|> List.map (getPropertyMetadata tref.Name.Value)
559559
let baseType =
560560
let metadata : ProvidedTypeMetadata = { Name = tref.Name.Value; Description = tref.Description }

src/FSharp.Data.GraphQL.Client/BaseTypes.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ type RecordBase (name : string, properties : RecordProperty seq) =
104104

105105
let properties =
106106
if not (isNull properties)
107-
then properties |> Seq.sortBy (fun x -> x.Name) |> List.ofSeq
107+
then properties |> Seq.sortBy _.Name |> List.ofSeq
108108
else []
109109

110110
/// Gets the name of this provided record type.

src/FSharp.Data.GraphQL.Client/Extensions.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module internal Extensions =
2323
member this.MD5Hash() =
2424
Encoding.UTF8.GetBytes(this)
2525
|> MD5.Create().ComputeHash
26-
|> Array.map (fun x -> x.ToString("x2"))
26+
|> Array.map _.ToString("x2")
2727
|> Array.reduce (+)
2828

2929
/// Basic operations on lists.

src/FSharp.Data.GraphQL.Server/Execution.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ and private live (inputContext : InputExecutionContextProvider) (ctx : ResolveFi
336336
|> Observable.mergeInner
337337

338338
let provider = ctx.Schema.LiveFieldSubscriptionProvider
339-
let filter = provider.TryFind typeName name |> Option.map (fun x -> x.Filter)
339+
let filter = provider.TryFind typeName name |> Option.map _.Filter
340340
let updates =
341341
match filter with
342342
| Some filterFn -> provider.Add (filterFn parent) typeName name |> Observable.bind resolveUpdate

src/FSharp.Data.GraphQL.Server/Executor.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ type Executor<'Root>(schema: ISchema<'Root>, middlewares : IExecutorMiddleware s
170170
Metadata = meta
171171
Operation = operation
172172
DocumentId = documentId }
173-
return runMiddlewares (fun x -> x.PlanOperation) planningCtx planOperation
173+
return runMiddlewares _.PlanOperation planningCtx planOperation
174174
| None -> return! Error <| [ GQLProblemDetails.CreateWithKind (
175175
"No operation with specified name has been found for provided document",
176176
ErrorKind.Validation

src/FSharp.Data.GraphQL.Server/Values.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ let rec internal compileByType
105105
| InputCustom customDef -> fun inputContext value variables -> customDef.CoerceInput inputContext (InlineConstant value) variables
106106
| InputObject objDef ->
107107
let objType = objDef.Type
108-
let ctor = ReflectionHelper.matchConstructor objType (objDef.Fields |> Array.map (fun x -> x.Name))
108+
let ctor = ReflectionHelper.matchConstructor objType (objDef.Fields |> Array.map _.Name)
109109

110110
let parametersMap =
111111
let typeMismatchParameters = HashSet ()

tests/FSharp.Data.GraphQL.IntegrationTests/SwapiRemoteProviderTests.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ module FileOperation =
174174
Operation.Types.HeroFields.FriendsFields.EdgesFields.NodeFields.Human(name = "Leia Organa", homePlanet = "Alderaan")
175175
Operation.Types.HeroFields.FriendsFields.EdgesFields.NodeFields.Droid(name = "C-3PO", primaryFunction = "Protocol")
176176
Operation.Types.HeroFields.FriendsFields.EdgesFields.NodeFields.Droid(name = "R2-D2", primaryFunction = "Astromech") |]
177-
let friends = result.Data.Value.Hero.Value.Friends.Edges |> Array.map (fun x -> x.Node)
177+
let friends = result.Data.Value.Hero.Value.Friends.Edges |> Array.map _.Node
178178
friends |> equals expectedFriends
179179
result.Data.Value.Hero.Value.HomePlanet |> equals (Some "Tatooine")
180180
let actual = normalize <| sprintf "%A" result.Data

tests/FSharp.Data.GraphQL.Tests/DeferredTests.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ let sub =
247247
{ FieldName = "live"
248248
TypeName = "Data"
249249
Filter = (fun (x : TestSubject) (y : TestSubject) -> x.id = y.id)
250-
Project = (fun x -> x.live) }
250+
Project = _.live }
251251

252252
schemaConfig.LiveFieldSubscriptionProvider.Register sub
253253

0 commit comments

Comments
 (0)