-
Notifications
You must be signed in to change notification settings - Fork 1
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
of
and to
functions, additional operators
#6
Conversation
* `empty` * `singleton` * `ofSeq` * `ofAsync` * `ofTask` * `toArray` * `toList` * `toLookup`
* `catch` * `chunkBy` * `chunkBySize` * `merge` * `choose`
How does the user know which of these are blocking and which not? (So a hot observable may block the thread and never return.)
|
Maybe we should introduce |
or maybe just be clear in xml comments? |
let inline merge (source1, source2) = ObservableExtensions.Merge (source1, source2) | ||
|
||
/// Returns an observable sequence that contains only a single element | ||
let inline singleton item = Observable.Return<'T> item |
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 hate this "sigleton" because it reminds people of OO GoF desgin-pattern of singleton which this is not, this is not a static instance and there can be more by just merging this. This is rather "lift my value to this computation expression", I don't know if there are better more F#pish names like Option.ofObj or Task.FromResult.
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 agree it looks strange. I see such naming is used in Java https://www.javatpoint.com/java-collections-singleton-method and Haskell too.
https://github.com/dotnet/fsharp/blob/a90f6d1b7573053e385a008da589233397bec48b/src/FSharp.Core/seqcore.fs#L133
What do you think about the remarks on modules? |
Looks ok to me. |
src/FSharp.Control.R3/Observable.fs
Outdated
@@ -11,13 +12,38 @@ let inline bind ([<InlineIfLambda>] f : 'T -> Observable<'TNext>) source = Obser | |||
/// Converts the elements of the sequence to the specified type | |||
let inline cast<'T, 'CastType> (source) = ObservableExtensions.Cast<'T, 'CastType> (source) | |||
|
|||
let inline catch ([<InlineIfLambda>] f : 'Exn -> Observable<'TNext>) o = ObservableExtensions.Catch (o, f) |
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.
Because the R3 exception handling significantly differs from Rx, this could need some xml comments as well. (R3 docs: "Stopping the pipeline at OnError is a mistake.")
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.
Added XML comment with remarks
Added |
Proposed Changes
Add
empty
singleton
ofSeq
ofAsync
ofTask
toArray
toList
toLookup
catch
chunkBy
chunkBySize
merge
choose
ofType
Types of changes
What types of changes does your code introduce to FSharp.Control.R3?
New feature (non-breaking change which adds functionality)
Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.