Iltotore / iron

Strong type constraints for Scala
https://iltotore.github.io/iron/docs/
Apache License 2.0
457 stars 43 forks source link

Use non-boxing `forall` and `exists` methods on strings #154

Closed kyri-petrou closed 1 year ago

kyri-petrou commented 1 year ago

Scala's Function1 doesn't have a specialization on Char, which means that each char in a string that is evaluated is boxed. This causes unnecessary object allocations when refining values that are not statically known.

This PR fixes this issue by reimplementing these methods they are in the std library, but using an EvalChar argument instead which prevents boxing