bow-swift / bow

🏹 Bow is a cross-platform library for Typed Functional Programming in Swift
https://bow-swift.io
Other
643 stars 32 forks source link

Implement Coyoneda based on Exists #623

Closed ferranpujolcamins closed 3 years ago

ferranpujolcamins commented 3 years ago

Successor of #621, please refer to the description of that Pr for details.

I was able to find a way to implement Exists run method without any ugly hacks or force casts.

Coyoneda Tests all pass. I added a simple property-based test for Exists, I cannot think of any additional properties nor have I found any references. In purescript, they only have the test based on the implementation of Stream.

The implementation of Free-er monad (Haskell's Program) as Free<Coyoneda<F>> (coming soon) works with this PR 🎉

Here I have additional changes for this PR that make Coyoneda's map function stack safe. I kept this changes separated from the main PR for now to keep things easier to digest.

truizlop commented 3 years ago

@ferranpujolcamins can you take a look at the conflicts before we merge this?

ferranpujolcamins commented 3 years ago

Conflicts fixed!