Typeclasses for Beginners

P.S This post is for beginners, experienced developers can skip this 🙂

In this post, I will try my best to avoid using conventions so as not to confuse the beginner, I just want to solely pass the message across without confusing the reader with general conventions.

As a Scala developer, I had always heard about Typeclasses, and it seemed really hard to understand, but I’ll try to simplify it so much so other beginners can easily understand this great feature in Scala.

Before I define what TypeClasses are, let’s start with a small problem and hope that by trying to solve the problem will help you understand the concept better.

Continue reading “Typeclasses for Beginners”

Functional Programming with ZIO and Akka HTTP

Huge disclaimer, I’m not yet some FP expert who can boldly explain category theory and all them really fancy terms, but this article explains how I was able to build a pretty basic and functional Todo CRUD app using ZIO and Akka Http.

Granted, there are some functional Http clients such as http4s, but I’ve been using Akka Http for ages and I just needed some FP library that I could integrate with Akka Http, and since there is so much buzz around ZIO, I decided to use this pretty awesome library. So here goes 😄.

Before we get into some code, I just wanna explain what I think an effect is as this is one term that will be used a lot in this article. As easily explained in this blogpost, an <strong>effect</strong> is what a Monad models, or handles, when you see an Option, you immediately think of a value that may or may not exist, similarly, a future represents some async computation that may or may not succeed, a List represents zero or more items of some type. What you’ll notice is that all these data structures, encapsulate some sort of data model and have some well-defined API’s that help you manipulate their contents or effects :).

Continue reading “Functional Programming with ZIO and Akka HTTP”