Skip to content

Commit 747c7bd

Browse files
xperiandriclaude
andcommitted
refactor: the Tuple and Option modules of FlatList call the default modules by their short names
Each of these files opens `FSharp.Collections.Immutable`, and inside `FSharp.Collections.Immutable.Tuple.FlatList` the name `FlatList` reaches the default module, also for the functions that both modules define, so the full namespace in front of it added nothing. The compiled code is the same: the opcodes and the called methods of every method of both builds match one to one. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent fcb1343 commit 747c7bd

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

‎src/FSharp.Collections.Immutable/FlatList/FlatListOption.fs‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ let tryItem index (array : FlatList<'T>) = Array.tryItem index (unwrapArray (nam
2626
let tryLast (array : FlatList<'T>) = Array.tryLast (unwrapArray (nameof array) array)
2727

2828
[<CompiledName "TryTail">]
29-
let tryTail (array : FlatList<'T>) =
30-
FSharp.Collections.Immutable.FlatList.tryTail array
31-
|> ValueOption.toOption
29+
let tryTail (array : FlatList<'T>) = FlatList.tryTail array |> ValueOption.toOption
3230

3331
// ---- Search ----
3432

‎src/FSharp.Collections.Immutable/FlatList/FlatListTuple.fs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ let unfold (generator : 'State -> ('T * 'State) voption) (state : 'State) =
1515
| ValueSome (item, next) -> ValueSome (struct (item, next))
1616
| ValueNone -> ValueNone
1717

18-
FSharp.Collections.Immutable.FlatList.unfold generateStruct state
18+
FlatList.unfold generateStruct state
1919

2020
// ---- Transformation ----
2121

@@ -72,7 +72,7 @@ let mapFold (mapping : 'State -> 'T -> 'Result * 'State) (state : 'State) (array
7272
let result, next = mapping state item
7373
struct (result, next)
7474

75-
let struct (results, final) = FSharp.Collections.Immutable.FlatList.mapFold mapStruct state array
75+
let struct (results, final) = FlatList.mapFold mapStruct state array
7676
results, final
7777

7878
[<CompiledName "MapFoldBack">]
@@ -81,7 +81,7 @@ let mapFoldBack (mapping : 'T -> 'State -> 'Result * 'State) (array : FlatList<'
8181
let result, next = mapping item state
8282
struct (result, next)
8383

84-
let struct (results, final) = FSharp.Collections.Immutable.FlatList.mapFoldBack mapStruct array state
84+
let struct (results, final) = FlatList.mapFoldBack mapStruct array state
8585
results, final
8686

8787
// ---- Partitioning and grouping ----
@@ -98,17 +98,17 @@ let groupBy (projection : 'T -> 'Key) (array : FlatList<'T>) =
9898

9999
[<CompiledName "Partition">]
100100
let partition predicate (array : FlatList<'T>) =
101-
let struct (accepted, rejected) = FSharp.Collections.Immutable.FlatList.partition predicate array
101+
let struct (accepted, rejected) = FlatList.partition predicate array
102102
accepted, rejected
103103

104104
[<CompiledName "PartitionWith">]
105105
let partitionWith (partitioner : 'T -> Choice<'T1, 'T2>) (array : FlatList<'T>) =
106-
let struct (first, second) = FSharp.Collections.Immutable.FlatList.partitionWith partitioner array
106+
let struct (first, second) = FlatList.partitionWith partitioner array
107107
first, second
108108

109109
[<CompiledName "SplitAt">]
110110
let splitAt index (array : FlatList<'T>) =
111-
let struct (before, after) = FSharp.Collections.Immutable.FlatList.splitAt index array
111+
let struct (before, after) = FlatList.splitAt index array
112112
before, after
113113

114114
// As in the module above: the functions that build a tuple per element share their algorithm with the default module,

0 commit comments

Comments
 (0)