Repository navigation
feat(observable)!: make Observable.choose take a voption chooser, add ObservableOption - #30
Open
xperiandri wants to merge 1 commit into
Open
xperiandri wants to merge 1 commit into
xperiandri wants to merge 1 commit into
Conversation
… add `ObservableOption` `Observable.choose` always resolved to FSharp.Core's `IObservable` version (FS0001) after `open FSharp.Control.R3`, because the R3 variants were static members of types in AutoOpen modules nested inside the non-AutoOpen `Observable` module. Their `[<Extension>]` members also added `.choose` to every F# function value. `choose` is now a function of the `Observable` module, which shadows FSharp.Core's `Observable.choose`. Like every function of the library that works with optional values it takes a `voption` chooser, which does not allocate. The `option` variant lives in the new `ObservableOption` module, which requires qualified access: `ObservableOption.choose`. BREAKING CHANGE: the `OptionExtensions` and `ValueOptionExtensions` types are removed; `Observable.choose` takes `'T -> 'R voption`, use `ObservableOption.choose` for `'T -> 'R option`. After `open FSharp.Control.R3`, `Observable.choose` is the R3 function; use `Microsoft.FSharp.Control.Observable.choose` for `IObservable` and F# events. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 5, 2026
This was referenced Oct 5, 2026
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused API changes are internally consistent, documented, and correctly integrated into compilation order.
Review effort: Balanced
Findings: None
What changed in this PR
Introduces allocation-free voption filtering through Observable.choose while providing an option-based alternative.
Changes:
- Replaces extension-based
chooseAPIs with module functions. - Adds the qualified
ObservableOption.choose. - Updates project metadata and breaking-change documentation.
| File | Description |
|---|---|
src/FSharp.Control.R3/Observable.fs |
Adds the voption-based Observable.choose. |
src/FSharp.Control.R3/ObservableOption.fs |
Adds the option-based variant. |
src/FSharp.Control.R3/FSharp.Control.R3.fsproj |
Includes the new source file. |
CHANGELOG.md |
Documents the API changes. |
.github/copilot-instructions.md |
Adds the new module to the project structure. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
3 of 6 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Part of splitting #22 into small pull requests that can be reviewed one at a time. It is stacked on #29 (
feat/observable-of-seq), so it shows only its own change; merge #29 first.Observable.choosealways resolved to FSharp.Core'sIObservableversion (FS0001) afteropen FSharp.Control.R3, because the R3 variants were static members of types in AutoOpen modules nested inside the non-AutoOpenObservablemodule. Their[<Extension>]members also added.chooseto every F# function value.chooseis now a function of theObservablemodule, which shadows FSharp.Core'sObservable.choose. Like every function of the library that works with optional values it takes avoptionchooser, which does not allocate. Theoptionvariant lives in the newObservableOptionmodule, which requires qualified access:ObservableOption.choose.Types of changes
What types of changes does your code introduce to FSharp.Control.R3?
Put an
xin the boxes that applyChecklist
Put an
xin 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.Further comments
Breaking change: the
OptionExtensionsandValueOptionExtensionstypes are removed;Observable.choosetakes'T -> 'R voption, useObservableOption.choosefor'T -> 'R option. Afteropen FSharp.Control.R3,Observable.chooseis the R3 function; useMicrosoft.FSharp.Control.Observable.chooseforIObservableand F# events.Tests (in #22): the
chooseandObservableOption choosetests ofObservableTests.fs, and thechunkByBoundariesscenarios ofIntegrationTests.fsthat feedchoose.Stack – every pull request is based on the one before it, so each shows only its own change. Merge them in this order:
AwaitOperationConfigurationcases withAwait#23 refactor!: prefixAwaitOperationConfigurationcases withAwaitmapAsyncoptions eagerly #24 fix: validate the concurrency limit ofmapAsyncoptions eagerlyyield/zerosynchronously to keep element order #25 fix(rxquery): emityield/zerosynchronously to keep element ordersumBywithUnchecked.defaultof#26 fix(rxquery)!: stop seedingsumBywithUnchecked.defaultofrxqueryWithto cancel the terminal query operators #27 feat(rxquery): addrxqueryWithto cancel the terminal query operatorsofSeqreachable asObservable.ofSeq#29 feat(observable)!: makeofSeqreachable asObservable.ofSeqObservable.choosetake avoptionchooser, addObservableOption#30 feat(observable)!: makeObservable.choosetake avoptionchooser, addObservableOption← this pull requestchunkByBoundariesfor boundaries of any element type #31 feat(observable): addchunkByBoundariesfor boundaries of any element typecancellationTokenfromtoLookup#35 fix(async)!: remove the ignoredcancellationTokenfromtoLookupiterAsyncthroughForEachAsyncinstead ofCountAsync#37 fix: wait foriterAsyncthroughForEachAsyncinstead ofCountAsynciterAsyncreliably and never lose a failure of its action #38 fix: stopiterAsyncreliably and never lose a failure of its actionofTaskconfigureAwaittotrue#39 fix(task)!: defaultofTaskconfigureAwaittotruetoArrayandtoListinto theTask.Observablemodule #40 feat(task)!: movetoArrayandtoListinto theTask.Observablemodulebind,catchandmapAsync#42 docs: document the R3 1.3.1 limitations ofbind,catchandmapAsync🤖 Generated with Claude Code