arrow-kt / arrow-core

Λrrow Core is part of Λrrow, a functional companion to Kotlin's Standard Library
http://arrow-kt.io
Other
81 stars 30 forks source link

CU-cn1pxw Deprecate AndThen and always use underneath `andThen` and `compose`. #320

Closed nomisRev closed 3 years ago

nomisRev commented 3 years ago

This PR makes AndThen internal, and uses it under andThen and compose to automatically try and make them stack-safe.

The rationale of deprecating AndThen to make it internal is that AndThen cannot guarantee stack-safety anyway. It makes the assumption that val f: (A) -> B is of depth 0. If f is not of depth 0, it can still result in a stack-overflow.

andThen and compose are duplicated between arrow-syntax, and arrow-core but we might merge these two modules in the 0.13.0 release, at that point we can deprecate the andThen and compose in arrow.core in favor of arrow.syntax.* or the other way around.

franciscodr commented 3 years ago

Task linked: CU-cn1pxw Remove extension annotation for AndThen