Eric Weise

Finance and Technology Blog

Category Theory in Kotlin - Monoids

Introduction I am starting a series of blog posts pertaining to a book that I am reading called Category Theory for Programmers by Bartosz Milewski. Bartosz has already done a series a posts on the topics in the book so instead of covering the same ground, my posts will be specifically about implementing the various category pattern in kotlin. I will try to make them as easy to understand as possible and provide useful examples.

18 Sep 2019

Pushing Side Effects to the Side

Functional programming provides a treasure trove of useful patterns, one of which is pushing side effects to the edges of your application. Side effects are functions that have non-deterministic behavior. Examples include making an Http call or persisting data to the database These calls can fail due to network issues or other outside influences. But side effects can also be functions that don’t fail such as retrieving the current time or a random number, since they don’t always give the same value back.

12 Jun 2017

Akka Cluster Example

Akka provides powerful clustering capabilities but reading through the online docs it may not be obvious how to set it up for your particular needs. For my use case, I wanted to create multiple actors representing a particular service that would run on more that one machine. If one machine failed, actors on other machines could still handle the requests, as in a typical high availability scenario. In addition, I did not want the calling actor to have any knowledge of which machines could handle the request, only that one actor in the cluster would handle it.

5 Feb 2014