Author: Akash Kumar

Introduction to zio-json | Encoding Decoding

Reading Time: 2 minutes In this blog we discuss how encoding and decoding of data is perform in zio using the zio-json. According to ZIO documentation, we know ZIO is a library for asynchronous and concurrent programming that promotes pure functional programming. At the core of ZIO is ZIO, a powerful effect type inspired by Haskell’s IO monad.The ZIO[R, E, A] data type has three type parameters: R – Environment Type:- The effect requires an environment Continue Reading

How to Compose Layers in Zio

Reading Time: 5 minutes Introduction According to ZIO documentation, we know ZIO is a library for asynchronous and concurrent programming that promotes pure functional programming. The core of the ZIO library provides a powerful effect type ZIO inspired by Haskell’s IO monad. The value of this type doesn’t do anything itself. It is just a description of something that should be done.ZIO runtime system is responsible for actually doing what is Continue Reading

zio

How to run effects in Zio

Reading Time: 3 minutes As we all know ZIO is a zero-dependency library for asynchronous and concurrent programming in Scala. It is a functional effect system in Scala. A functional effect is a description of doing some operations(“println(“Hello World”) in a pure functional way(“zio.console.putStrLn(“Hello World”)”. In Zio we create the programs using the different ZIO constructors and combinators. These programs are basically the ZIO effects which are just a data structure that describes the Continue Reading

zio kafka

Introduction to Zio-Kafka

Reading Time: 3 minutes In this blog we discuss how to read messages from kafka and process them using the zio-kafka library. Apache Kafka is a distributed publish-subscribe messaging system and a robust queue that can handle a high volume of data and enables you to pass messages from one end-point to another. ZIO is a zero-dependency library for asynchronous and concurrent programming in Scala. It is a functional effect system in Scala. ZIO Continue Reading

Introduction to Finite State Machines

Reading Time: 2 minutes In this we are discuss about the Finite State Machines(FSM) implementation using the Akka Actor Model. Finite State Machines First we go through the the proper defination of FSM as describes in Erlang Design Principles. A FSM can be understand in the form of relation. This can be define as: If we are in state S and the event E occurs, we should perform the actions A and make a transition Continue Reading

Play-Json | Serialization of Case classes(23 + fields)

Reading Time: 2 minutes Overview In this blog we discuss about how to Deserialise and Serialise case classes having greater than 22 fields using play-json-extensions. Library Dependencies Add the given dependencies to your build.sbt Introduction As we use play-json for deserialise and serialise case classes in different scala framework like play,akka etc. Sometimes we encounter the problem for formating these case classes which have more then 22 fields fields.As Continue Reading

sttp : The Scala HTTP Client

Reading Time: 2 minutes Introduction It is the open-source library which provides the services for send Http requests and tackle the return responses. It maintains the proper exception handling of request and response.So now we discuss some features of this library. Library Dependency For using the services of sttp client add the follwing dependency in the build.sbt of sbt project. Import the given package in our code for using Continue Reading

Scala | Call by Value and Call by Name

Reading Time: 2 minutes In this blog we discuss about different ways of passing arguments in function call in scala. Call-by-Value By default scala use call-by-value for passing arguments to a function.Here is a function adder that uses the call-by-value strategy. The Call-by-value function evaluate the passed-in expression value before calling the function, so that same value accessed every time.Above all call by-value strategy has the advantage that it evaluates Continue Reading

Monads: Functional Programming in Scala

Reading Time: 3 minutes Introduction Monads have a deep basis in the mathematical side of computer science, coming out of category theory. Monads are nothing more than a mechanism to sequence computations around values augmented with some additional feature. This section will therefore present a condensed and simplified take on monads. As we said, a monad augments a value with some additional features. Such features are called effects. Some well-known effects Continue Reading