Skip to content
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

.map() .toVector with length constraints #273

Closed
mio-19 opened this issue Sep 21, 2024 · 1 comment
Closed

.map() .toVector with length constraints #273

mio-19 opened this issue Sep 21, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@mio-19
Copy link

mio-19 commented Sep 21, 2024

Is your feature request related to a problem? Please describe.
iron can't detect that methods like .map and .toVector keep length unchanged.

Describe the solution you'd like
Add logic for them on compile-time

Describe alternatives you've considered

@mio-19 mio-19 added the enhancement New feature or request label Sep 21, 2024
@Iltotore
Copy link
Owner

The problem is unfortunately out of the scope of Iron in its current state. In order to achieve this, the best way would be to redefine map, toVector etc. signatures, maybe in a separated class (look at Cats'NonEmptyList for example).

It might be possible to create a compiler-plugin for that or just support in during compile-time refinement but there are far too many methods in the same situation to handle them all so I'm in favor of not adding specific support for map and toVector and use assume when necessary instead.

@Iltotore Iltotore closed this as not planned Won't fix, can't repro, duplicate, stale Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants