Introducing Bow - Functional Programming for Swift

Introducing Bow - Functional Programming for Swift

The release of Arrow in early 2018, based on the joint efforts of the Kategory and funKTionale teams, eased the introduction of Functional Programming concepts in Kotlin. Developers can now benefit enormously from the advantages that FP brings to this language. Kotlin is mainly used for Android mobile development so the rise of Arrow prompted a reoccurring question from iOS developers; What about our Swift counterpart?

Today, we present an answer to that question. We are happy to announce Bow, a companion library to Swift Foundation that brings FP concepts into Swift. The library is available as an open source project on Github and has been designed to maximize similarity with Arrow. This way, Swift developers can take advantage of existing resources for Arrow and translate them to Bow with little effort.

Bow doesn’t have the same level of maturity as Arrow quite yet, nor the amount of features, but we will continue to invest in its growth in 2019. We appreciate and welcome contributions (of all levels) to help us make Bow the reference library for Functional Programming in Swift.

As of version 0.3.0, Bow is divided into multiple modules that can be imported upon convenience.


The Bow module is the core of the library and contains the following features:

  • Higher Kinded Types emulation: Swift does not have native support for Higher Kinded Types, although the Generics Manifesto states it will in the future. However, we added support to begin with as it’s needed in the rest of the library. The emulation is simple, but adds a small amount of boilerplate that we are working to automate.
  • Function manipulation utilities: operators for composing, currying, reversing, complementing, and memoizing functions are available as part of this module.
  • Data types: the core module provides some useful data types like Option, Either, Try, and NonEmptyList, as well as wrappers over types in Foundation, like ListK and SetK that enable using them as Higher Kinded Types.
  • Typeclasses and instances: definitions of usual typeclasses, like Functor, Monad, and Semigroup are part of this module. Also, instances for primitive types and the provided data types are available.
  • Monad transformers: types like StateT and WriterT are also offered in the core module.

The core module can be utilized with CocoaPods:

pod "Bow", "~> 0.3.0"


Utilities to work with immutable data structures such as Lenses, Prisms, and Traversals are part of the BowOptics module, which can be used with:

pod "BowOptics", "~> 0.3.0"


Working with recursive data structures and F-algebras is easier with the BowRecursionSchemes module.

pod "BowRecursionSchemes", "~> 0.3.0"


Create programs using a Free monad and define its interpretation later to make polymorphic programs with BowFree.

pod "BowFree", "~> 0.3.0"


Easily integrate with the popular library Result to convert from/to Bow’s data types to Result. As many other libraries already use Result as a return/input type, this can ease their interoperability with Bow.

pod "BowResult", "~> 0.3.0"


This module provides the IO data type to encapsulate effects, as well as the necessary typeclasses to work with effects in a polymorphic way.

pod "BowEffects", "~> 0.3.0"


Instead of using IO, users of RxSwift can still use reactive data types with the corresponding encapsulations that we provide in this module, namely ObservableK, SingleK, and MaybeK, to make them Higher Kinded Types.

pod "BowRx", "~> 0.3.0"


Users of the library BrightFutures can use the FutureK wrapper that converts Future into a Higher Kinded Type.

pod "BowBrightFutures", "~> 0.3.0"

The library can also be utilized using Carthage by adding this line to a Cartfile:

github "bow-swift/Bow" ~> 0.3.0

By adding this, separate frameworks will be built for each module that can be added to the project, based on your needs.

We would like to invite you to try Bow and give us your feedback. It will help us find out where the library can improve, and contribute towards making Swift a more functional programming language. Currently, we’re working on writing documentation and getting it ready for publication in the near future.

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

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.