-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
some helper functions #92
Conversation
because of `IReadOnlyCollection`
This reverts commit 39047d2.
|
||
|
||
[<Extension>] | ||
type ExtraIDictionary() = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the types ExtraIDictionary and ExtraIReadOnlyDictionary ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are extension classes that add TryFind
, which returns an Option
(that's the whole point) to C# dictionaries
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a class to hold the extension methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these extension methods, e.g. findExactlyOne, have no covering tests. Please add tests.
# Conflicts: # src/FSharpx.Collections/Collections.fs
|
||
|
||
[<Extension>] | ||
type ExtraIDictionary() = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are extension classes that add TryFind
, which returns an Option
(that's the whole point) to C# dictionaries
| Choice2Of2 x -> Some x | ||
| _ -> None | ||
let inline chooser a = match a with | ||
| Choice1Of2 x -> Some x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apologize, I've only now realized that there is this typo. It should be Choice2Of2
.
| Choice2Of2 x -> Some x | ||
| _ -> None | ||
let inline chooser a = match a with | ||
| Choice1Of2 x -> Some x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choice2Of2
| Choice2Of2 x -> Some x | ||
| _ -> None | ||
let inline chooser a = match a with | ||
| Choice1Of2 x -> Some x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choice2Of2
Can you please open PR with the fix?
…Sent from my iPhone
On Oct 22, 2021, at 23:52, Ondra Pelech ***@***.***> wrote:
@sideeffffect commented on this pull request.
In src/FSharpx.Collections/Collections.fs:
> Seq.choose chooser xs
/// Extracts from a seq of Choice all the Choice2Of2 elements. All the Choice2Of2 elements are extracted in order.
let inline choice2s xs =
- let chooser = function
- | Choice2Of2 x -> Some x
- | _ -> None
+ let inline chooser a = match a with
+ | Choice1Of2 x -> Some x
I apologize, I've only now realized that there is this typo. It should be Choice2Of2.
In src/FSharpx.Collections/Collections.fs:
> Array.choose chooser xs
/// Extracts from an array of Choice all the Choice2Of2 elements. All the Choice2Of2 elements are extracted in order.
let inline choice2s xs =
- let chooser = function
- | Choice2Of2 x -> Some x
- | _ -> None
+ let inline chooser a = match a with
+ | Choice1Of2 x -> Some x
Choice2Of2
In src/FSharpx.Collections/Collections.fs:
> List.choose chooser xs
/// Extracts from a list of Choice all the Choice2Of2 elements. All the Choice2Of2 elements are extracted in order.
let inline choice2s xs =
- let chooser = function
- | Choice2Of2 x -> Some x
- | _ -> None
+ let inline chooser a = match a with
+ | Choice1Of2 x -> Some x
Choice2Of2
In src/FSharpx.Collections/Collections.fs:
> @@ -481,8 +493,35 @@ module Dictionary =
| true,v -> Some v
| _ -> None
+ let inline toSeq (d:seq<KeyValuePair<'a, 'b>>) : seq<'a * 'b> =
+ d |> Seq.map (fun (KeyValue(x,y)) -> x, y)
+
+
+[<Extension>]
+type ExtraIDictionary() =
these are extension classes that add TryFind, which returns an Option (that's the whole point) to C# dictionaries
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
The fix: #184 |
No description provided.