Skip to content

Conversation

@jcranch
Copy link
Contributor

@jcranch jcranch commented Nov 1, 2023

This fills in a gap: we currently have:

  • fmap: no indices, no possibility of removal
  • filterMap: no indices, may remove elements
  • mapBy: indexed, may remove elements

This is the fourth combination: an indexed map with no possibility of removal.

The rationale:

  • In cases where one plans to use it, it is clearly slightly more efficient, since we don't have to check for emptiness when reassembling the structure.
  • It helps people who wish to implement a structured typeclass hierarchy like that in the witherable package.

@jcranch
Copy link
Contributor Author

jcranch commented Nov 1, 2023

I should mention - I don't regard this request as necessarily in final form. I'm happy to write tests if desired, and I'm happy to change the nomenclature.

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