Skip to content

Commit b66dd42

Browse files
xperiandriclaude
andcommitted
refactor: the Tuple and Option modules of SortedMap call the default modules by their short names
Each of these files opens `FSharp.Collections.Immutable`, and inside `FSharp.Collections.Immutable.Tuple.SortedMap` the name `SortedMap` 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 7d3263f commit b66dd42

2 files changed

Lines changed: 10 additions & 19 deletions

File tree

‎src/FSharp.Collections.Immutable/SortedMap/SortedMapOption.fs‎

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,31 @@ open FSharp.Collections.Immutable
99
// ---- Access ----
1010

1111
[<CompiledName "TryFind">]
12-
let tryFind (key : 'Key) (table : SortedMap<'Key, 'Value>) =
13-
FSharp.Collections.Immutable.SortedMap.tryFind key table
14-
|> ValueOption.toOption
12+
let tryFind (key : 'Key) (table : SortedMap<'Key, 'Value>) = SortedMap.tryFind key table |> ValueOption.toOption
1513

1614
[<CompiledName "TryGetKey">]
17-
let tryGetKey (key : 'Key) (table : SortedMap<'Key, 'Value>) =
18-
FSharp.Collections.Immutable.SortedMap.tryGetKey key table
19-
|> ValueOption.toOption
15+
let tryGetKey (key : 'Key) (table : SortedMap<'Key, 'Value>) = SortedMap.tryGetKey key table |> ValueOption.toOption
2016

2117
// ---- Search ----
2218

2319
[<CompiledName "Pick">]
2420
let pick (chooser : 'Key -> 'Value -> 'U option) (table : SortedMap<'Key, 'Value>) =
25-
FSharp.Collections.Immutable.SortedMap.pick (fun key value -> chooser key value |> ValueOption.ofOption) table
21+
SortedMap.pick (fun key value -> chooser key value |> ValueOption.ofOption) table
2622

2723
[<CompiledName "TryFindKey">]
28-
let tryFindKey predicate (table : SortedMap<'Key, 'Value>) =
29-
FSharp.Collections.Immutable.SortedMap.tryFindKey predicate table
30-
|> ValueOption.toOption
24+
let tryFindKey predicate (table : SortedMap<'Key, 'Value>) = SortedMap.tryFindKey predicate table |> ValueOption.toOption
3125

3226
[<CompiledName "TryPick">]
3327
let tryPick (chooser : 'Key -> 'Value -> 'U option) (table : SortedMap<'Key, 'Value>) =
34-
FSharp.Collections.Immutable.SortedMap.tryPick (fun key value -> chooser key value |> ValueOption.ofOption) table
28+
SortedMap.tryPick (fun key value -> chooser key value |> ValueOption.ofOption) table
3529
|> ValueOption.toOption
3630

3731
// ---- Transformation ----
3832

3933
[<CompiledName "Change">]
4034
let change (key : 'Key) (f : 'Value option -> 'Value option) (table : SortedMap<'Key, 'Value>) =
41-
FSharp.Collections.Immutable.SortedMap.change
42-
key
43-
(fun current -> f (ValueOption.toOption current) |> ValueOption.ofOption)
44-
table
35+
SortedMap.change key (fun current -> f (ValueOption.toOption current) |> ValueOption.ofOption) table
4536

4637
[<CompiledName "Choose">]
4738
let choose (chooser : 'Key -> 'Value -> 'U option) (table : SortedMap<'Key, 'Value>) =
48-
FSharp.Collections.Immutable.SortedMap.choose (fun key value -> chooser key value |> ValueOption.ofOption) table
39+
SortedMap.choose (fun key value -> chooser key value |> ValueOption.ofOption) table

‎src/FSharp.Collections.Immutable/SortedMap/SortedMapTuple.fs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ open FSharp.Collections.Immutable
1010

1111
[<CompiledName "MaxKeyValue">]
1212
let maxKeyValue (table : SortedMap<'Key, 'Value>) =
13-
let struct (key, value) = FSharp.Collections.Immutable.SortedMap.maxKeyValue table
13+
let struct (key, value) = SortedMap.maxKeyValue table
1414
key, value
1515

1616
[<CompiledName "MinKeyValue">]
1717
let minKeyValue (table : SortedMap<'Key, 'Value>) =
18-
let struct (key, value) = FSharp.Collections.Immutable.SortedMap.minKeyValue table
18+
let struct (key, value) = SortedMap.minKeyValue table
1919
key, value
2020

2121
// ---- Partitioning ----
2222

2323
[<CompiledName "Partition">]
2424
let partition predicate (table : SortedMap<'Key, 'Value>) =
25-
let struct (accepted, rejected) = FSharp.Collections.Immutable.SortedMap.partition predicate table
25+
let struct (accepted, rejected) = SortedMap.partition predicate table
2626
accepted, rejected
2727

2828
// ---- Conversion ----

0 commit comments

Comments
 (0)