effect icon indicating copy to clipboard operation
effect copied to clipboard

effect: add Stream.filterMapEffectOption function

Open Schniz opened this issue 1 year ago • 10 comments

Type

  • [ ] Refactor
  • [x] Feature
  • [ ] Bug Fix
  • [ ] Optimization
  • [ ] Documentation Update

Description

Adds a Stream.mapEffectFilter function that maps items of a stream effectfully, and then filters them.

Related

  • Closes #3018

Schniz avatar Jun 20 '24 12:06 Schniz

⚠️ No Changeset found

Latest commit: b9b69acf33a72aed1f6107059328cc3bdac231d6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Jun 20 '24 12:06 changeset-bot[bot]

cc @tim-smart @IMax153 what do we think of the name?

mikearnaldi avatar Jun 22 '24 11:06 mikearnaldi

cc @tim-smart @IMax153 what do we think of the name?

I'll be honest, I'm not a fan of this name. I find it confusing given there's also filterMapEffect.

That being said I don't have a good alternative at the moment 😬.

IMax153 avatar Jun 22 '24 12:06 IMax153

There are couple of alternatives I generated with AI: all feel as wrong IMO

https://sdk.vercel.ai/s/7HAZozu43jqI

Schniz avatar Jun 22 '24 13:06 Schniz

Can we overload the predicate return type of filterMapEffect to be Option<Effect> | Effect<Option> I wonder.

The only case that could cause issues is if you return Option<Option>.

tim-smart avatar Jun 24 '24 01:06 tim-smart

Can we overload the predicate return type of filterMapEffect to be Option<Effect> | Effect<Option> I wonder.

The only case that could cause issues is if you return Option<Option>.

given Option is an Effect a union such as this would not be possible

mikearnaldi avatar Jun 27 '24 16:06 mikearnaldi

Stream.filterMapEffectOption?

tim-smart avatar Jul 01 '24 03:07 tim-smart

Stream.filterMapEffectOption?

let's go for this and re-think in 4.0 if we can have a single function

mikearnaldi avatar Jul 01 '24 10:07 mikearnaldi

Yea I second Tim's suggestion - Stream.filterMapEffectOption is good for now 👍

IMax153 avatar Jul 01 '24 14:07 IMax153

:done: :effect-ts:

Schniz avatar Jul 02 '24 09:07 Schniz

apologies @Schniz I merged by mistake, needs to be re-opened given the lack of a changeset

mikearnaldi avatar Jul 03 '24 16:07 mikearnaldi