Bow 0.8.0 is now available

Bow 0.8.0 is now available

The team has been hard at work in this first third of the year, and today we unveil part of what we have been doing: Bow 0.8.0 is now available! This release includes several important additions that lay the foundations for other tools and libraries that we are building. But, in the meantime, continue reading to get a feeling for what’s new in Bow 0.8.0.

Cleaning duties

An important part of project management is making sure the code remains clean and approachable both to maintainers and external contributors. Over the years, the library has been under several important refactorings, which made some parts of the code difficult to read and maintain, especially in the core module and its associated testing modules. We have devoted time to cleaning things up, to make the project more accessible to people who want to contribute. As a very nice side effect, while rewriting the tests, we increased the test coverage of the code, so this was a big win-win!

Trampolining and stack safety

Recursion is widely used in Functional Programming to solve problems, but it has a problem: if the recursion is deep, we might end up consuming all the stack space and face the dreaded stack overflow problem, causing our software to crash. In order to avoid this problem, this release includes the Trampoline type, which helps us write code in a recursive manner, but will run it as a loop, avoiding stack issues.


In our continuous effort to make the library easier to use, and at the same time help people learn Functional Programming, we keep increasing the number of entries in our documentation, with the addition of 16 new pages in this release, and extensions in existing ones. We are writing it in such a way that ideas are illustrated using Swift and Bow examples, but the concepts are equally applicable in other languages or libraries for FP. Nonetheless, if you find some concept that is challenging to understand, or that we are not covering yet, we are looking forward to your feedback!

GitHub Actions

Although this is not a feature of the library per se, it is worth noting that we moved our continuous integration services from Travis to GitHub Actions. In our case, we run different tasks in every pull request:

  • We build and test all modules in the library.
  • We compile the documentation to verify the changes that were introduced do not break it.
  • When a pull request is merged, we generate the content of the documentation using nef and jekyll, and we deploy it using GitHub Pages.

We have observed an important increase in speed while running these tasks on GitHub actions, compared to Travis, especially regarding spawning time, where running these tasks seems much more lightweight in GitHub Actions. This results in shorter build times (around 3-4 minutes to build and test, compared to 15-20 minutes in Travis) and shorter deployment times (around 12 minutes, compared to 40-45 minutes that it used to be).

Linux compatibility

We’ve been working hard on becoming compatible with Linux. While Swift already runs nicely on Linux, there are some subtle differences compared to writing the same code on macOS. Also, some modules were using APIs that are only available on macOS and do not have a counterpart on Linux. All those peculiarities have been addressed so that you can now enjoy Functional Programming with Swift on Linux too.

Swift 5.2 ready

Swift 5.2 has arrived with some useful treats for Bow that we’re leveraging in this release. Particularly, the two key enhancements are the possibility to use KeyPaths as functions (especially useful in map or contramap operations), and the callAsFunction mechanism, that lets us invoke types that wrap function-like structures as if they were actually functions. Both enhancements are syntactic sugar, but makes our APIs read much more nicely.


The biggest effort in this release has been in the core module and regarding Comonads. This is probably the most advanced part of the library at the moment, and would definitely need a series of posts to explain the concepts behind it, but we will try to summarize the key takeaways.

Comonads are the lesser known duals of Monads. While monadic operations introduce context when run, comonadic operations need to consume context; that is, they model some sort of context-dependent operations. Just like monads, which can be stacked to sum up their effects using monad transformers, we can do the same using comonad transformers, and we still have the same dualities: for the monad transformers ReaderT, WriterT, and StateT, we have comonad transformers EnvT, TracedT, and StoreT, respectively. Their behavior is abstracted and captured in type classes, just like with their duals. This introduces the notion of pairing between a monad and a comonad; a pairing provides a way of exploring the context of a comonad using its dual monad as actions on that space.

Besides these types, there are other types that can provide instances of Comonad, but their duals are not so obvious; that is the case with Moore, Sum, or Zipper, which are also included as part of this release. However, there is an important result: we can always get the best pairing monad for any comonad; that is, we can always find actions to explore their comonadic space. This is achieved with CoT, which given a comonad transformer, it provides the corresponding dual monad transformer. But we can go even further! Given a ComonadEnv, a ComonadTraced, or a ComonadStore, it is able to provide its best pairing MonadReader, MonadWriter, or MonadState, respectively.

These are very powerful results, and without further explanation, you may not see its direct application; but bear with us, we have found a very good way of putting them into practice (we just need a little more time to show you!).


We have added more small enhancements and bug fixes to this release, which continue to contribute towards making it more and more stable. We have also updated Bow OpenAPI, which we announced a few months ago, to use all the benefits we provide in this release.

We are very excited about this release, but even more so about what’s coming. Keep your eyes peeled; we will be launching a few more things in the upcoming weeks!

Please check out the following Bow resources. Comments and questions are welcome and encouraged!

Bow is proudly sponsored by 47 Degrees, a Functional Programming consultancy with a focus on the Scala, Kotlin, and Swift Programming languages which supports the active development of Bow.

Ensure the success of your project

47 Degrees can work with you to help manage the risks of technology evolution, develop a team of top-tier engaged developers, improve productivity, lower maintenance cost, increase hardware utilization, and improve product quality; all while using the best technologies.