bow icon indicating copy to clipboard operation
bow copied to clipboard

["Bug"] Free foldMap is not stack safe

Open ferranpujolcamins opened this issue 4 years ago • 2 comments

Description

The foldMap is stack safe test found in Arrow's Free is not present in Bow. Furthermore, the test fails if added.

I believe this is caused because the new Free implementation lacks the special flatMap case found in the old one. A possible solution is to try to generalize the trampoline implementation of #636 as shown in the paper linked below. Then we can make Trampoline<A> = Free<ForFunction0, A> like in Arrow.

Expected outcome

foldMap is stack safe

Observed outcome

foldMap is not stack safe

Code to reproduce the Bug

saferFree branch in my fork.

Bow modules, version, platform

Bow module, master branch.

Tooling

  • Xcode version:
  • Installation method: Carthage / Cocoapods / Swift Package Manager

Other

Some explanation of the issue and possible solution can be found in this paper

ferranpujolcamins avatar Oct 19 '20 13:10 ferranpujolcamins

Is this fixed now? I don't remember if you already addressed it.

truizlop avatar Oct 30 '20 08:10 truizlop

No, it's not fixed.

ferranpujolcamins avatar Oct 30 '20 11:10 ferranpujolcamins