Skip to content

Add filterCollect to Record, Map and variants#1604

Open
qlonik wants to merge 1 commit into
gcanti:masterfrom
qlonik-forks:filter-collect
Open

Add filterCollect to Record, Map and variants#1604
qlonik wants to merge 1 commit into
gcanti:masterfrom
qlonik-forks:filter-collect

Conversation

@qlonik

@qlonik qlonik commented Oct 20, 2021

Copy link
Copy Markdown
Contributor

There is filterMap as filtering extensions for map. This adds similar filtering variants for collect.

Comment thread src/Map.ts
*/
export const filterCollect: <K>(
O: Ord<K>
) => <A, B>(f: (k: K, a: A) => Option<B>) => (m: Map<K, A>) => Array<B> = RM.filterCollect as any

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if doing as any is a good idea. But it avoids duplication implementing the same function with a different signature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant