Skip to content

Commit a02535d

Browse files
committed
Use Seq.toList consistently
1 parent 456765f commit a02535d

9 files changed

Lines changed: 22 additions & 23 deletions

File tree

‎samples/chat-app/server/Schema.fs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module MapFrom =
6868
{
6969
Id = x.Id
7070
Name = x.Name
71-
Members = members |> Seq.map memberInDb_To_Member |> List.ofSeq
71+
Members = members |> Seq.map memberInDb_To_Member |> Seq.toList
7272
ChatRooms =
7373
FakePersistence.ChatRooms.Values
7474
|> Seq.filter (fun c -> x.ChatRooms |> List.contains c.Id)
@@ -512,7 +512,7 @@ module Schema =
512512
fun _ _ ->
513513
FakePersistence.Organizations.Values
514514
|> Seq.map MapFrom.organizationInDb_To_Organization
515-
|> List.ofSeq
515+
|> Seq.toList
516516
)
517517
]
518518
)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ module internal ProvidedEnum =
102102
Expr.NewObject(ctor, [ <@@ name @@>; <@@ item @@> ])
103103
ProvidedProperty(item, tdef, getterCode, isStatic = true))
104104
|> Seq.cast<MemberInfo>
105-
|> List.ofSeq)
105+
|> Seq.toList)
106106
tdef
107107

108108
type internal ProvidedTypeMetadata =
@@ -743,7 +743,7 @@ module internal Provider =
743743

744744
let schemaProvidedTypes = getSchemaProvidedTypes(schema, uploadInputTypeName, explicitOptionalParameters)
745745
let typeWrapper = ProvidedTypeDefinition("Types", None, isSealed = true)
746-
typeWrapper.AddMembers(schemaProvidedTypes |> Seq.map (fun kvp -> kvp.Value) |> List.ofSeq)
746+
typeWrapper.AddMembers(schemaProvidedTypes |> Seq.map (fun kvp -> kvp.Value) |> Seq.toList)
747747
let operationWrapper = ProvidedTypeDefinition("Operations", None, isSealed = true)
748748
let getContextMethodDef =
749749
let methodParameters =

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

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

130130
let properties =
131131
if not (isNull properties) then
132-
properties |> Seq.sortBy _.Name |> List.ofSeq
132+
properties |> Seq.sortBy _.Name |> Seq.toList
133133
else
134134
[]
135135

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ module internal Extensions =
2323
member this.MD5Hash() =
2424
Encoding.UTF8.GetBytes(this)
2525
|> MD5.Create().ComputeHash
26-
|> Array.map _.ToString("x2")
27-
|> Array.reduce (+)
26+
|> Seq.map _.ToString("x2")
27+
|> Seq.reduce (+)
2828

2929
/// Basic operations on lists.
3030
module internal List =
@@ -35,12 +35,11 @@ module internal List =
3535
let combinations (input : 'T list) =
3636
let rec helper (input : 'T list) (startIndex : int) (length : int) =
3737
let mutable combinations = List<List<'T>>()
38-
if length = 2
39-
then
38+
if length = 2 then
4039
let mutable combinationsIndex = 0
4140
for inputIndex = startIndex to (input.Length - 1) do
4241
for i = (inputIndex + 1) to (input.Length - 1) do
43-
combinations.Add(List<'T>())
42+
combinations.Add (List<'T>())
4443
combinations.[combinationsIndex].Add(input.[inputIndex])
4544
while combinations.[combinationsIndex].Count < length do
4645
combinations.[combinationsIndex].Add(input.[i])
@@ -53,17 +52,17 @@ module internal List =
5352
for index = 0 to (combinations.Count - 1) do
5453
combinations.[index].Insert(0, input.[i])
5554
for y = 0 to (combinations.Count - 1) do
56-
combinationsOfMore.Add(combinations.[y])
55+
combinationsOfMore.Add (combinations.[y])
5756
combinationsOfMore
5857
let output = List<List<'T>>()
59-
output.Add(List<'T>())
58+
output.Add (List<'T>())
6059
for i = 0 to (input.Length - 1) do
6160
let item = List<'T>()
62-
item.Add(input.[i])
63-
output.Add(item)
61+
item.Add (input.[i])
62+
output.Add (item)
6463
for i = 2 to input.Length do
6564
helper input 0 i |> output.AddRange
6665
output
6766
|> Seq.map List.ofSeq
68-
|> List.ofSeq
69-
|> List.map (fun x -> x, List.except x input)
67+
|> Seq.map (fun x -> x, List.except x input)
68+
|> Seq.toList

‎src/FSharp.Data.GraphQL.Server.Middleware/MiddlewareDefinitions.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ type internal ObjectListFilterMiddleware<'ObjectType, 'ListType>(reportToMetadat
7373
let compileMiddleware (ctx : SchemaCompileContext) (next : SchemaCompileContext -> unit) =
7474
let modifyFields (object : ObjectDef<'ObjectType>) (fields : FieldDef<'ObjectType> seq) =
7575
let args = [ Define.Input("filter", Nullable ObjectListFilterType) ]
76-
let fields = fields |> Seq.map _.WithArgs(args) |> List.ofSeq
76+
let fields = fields |> Seq.map _.WithArgs(args) |> Seq.toList
7777
object.WithFields(fields)
7878
let typesWithListFields =
7979
ctx.TypeMap.GetTypesWithListFields<'ObjectType, 'ListType>()

‎src/FSharp.Data.GraphQL.Server.Middleware/SchemaDefinitions.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ let rec private coerceObjectListFilterInput (variables : Variables) inputValue :
152152
|> splitSeqErrorsList
153153
match filterResults with
154154
| Error errs -> Error errs
155-
| Ok filters -> filters |> Seq.vchoose id |> List.ofSeq |> buildAnd |> Ok
155+
| Ok filters -> filters |> Seq.vchoose id |> Seq.toList |> buildAnd |> Ok
156156

157157
let rec parse inputValue =
158158
match inputValue with

‎src/FSharp.Data.GraphQL.Shared/Ast.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ and InputValue =
166166
ListValue (
167167
element.EnumerateArray ()
168168
|> Seq.map InputValue.OfJsonElement
169-
|> List.ofSeq
169+
|> Seq.toList
170170
)
171171
| JsonValueKind.Object ->
172172
ObjectValue (

‎src/FSharp.Data.GraphQL.Shared/Helpers/ObjAndStructConversions.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ module Seq =
6262

6363
module internal List =
6464

65-
let vchoose mapping list = list |> Seq.ofList |> Seq.vchoose mapping |> List.ofSeq
65+
let vchoose mapping list = list |> Seq.ofList |> Seq.vchoose mapping |> Seq.toList
6666

6767
let vtryFind predicate list = list |> Seq.ofList |> Seq.vtryFind predicate
6868

‎src/FSharp.Data.GraphQL.Shared/TypeSystem.fs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2196,7 +2196,7 @@ and TypeMap () =
21962196
| _ -> ValueNone)
21972197
)
21982198
|> Seq.vchoose id
2199-
|> List.ofSeq
2199+
|> Seq.toList
22002200

22012201
/// <summary>
22022202
/// Tries to find a FieldDef inside an ObjectDef by the object name and the field name.
@@ -2242,8 +2242,8 @@ and TypeMap () =
22422242
|> toSeq
22432243
|> Seq.map map
22442244
|> Seq.choose id
2245-
|> List.ofSeq))
2246-
|> List.ofSeq
2245+
|> Seq.toList))
2246+
|> Seq.toList
22472247

22482248
/// <summary>
22492249
/// Creates a new TypeMap instance, using a sequence of NamedDef's to fill it.

0 commit comments

Comments
 (0)