Category Archives: algebra

Functional APIs: an OOP approach to FP

In the series of posts about the essence of functional programming, we’ve already seen how we can build purely declarative programs using GADTs. This is a picture of what we got (using more standard cats/scalaz data types): This program above … Continue reading

Posted in algebra, functional programming, Scala, Type Class | Leave a comment

Lens, State Is Your Father

In our last post, we introduced IOCoalgebras as an alternative way of representing coalgebras from an algebraic viewpoint, where Lens was used as a guiding example. In fact, lens is an abstraction that belongs to the group of Optics, a … Continue reading

Posted in algebra, coalgebra, Lens, Optics, State, Type Class | Leave a comment

Yo Dawg, We Put an Algebra in Your Coalgebra

As Dan Piponi suggested in Cofree Meets Free, we may think of coalgebraic things as machines with buttons. In this post, we take this metaphor seriously and show how we can use algebras to model the Input/Output interface of the … Continue reading

Posted in algebra, coalgebra, Embedded DSLs, machine, Scala, Type Class | 2 Comments