Parsing from scratch - Part 4
Until now, we implemented a few relatively simple parsers; for parsing dates and hex colors. In this post, we are going to build a parser for parsing configuration key value pairs. This is a bit more …
Read more →
Until now, we implemented a few relatively simple parsers; for parsing dates and hex colors. In this post, we are going to build a parser for parsing configuration key value pairs. This is a bit more …
Read more →
Let us implement another simple parser, this time for semantic version. Read on.
Read more →
Having learnt how to write a simple parsing library from scratch, it is time to put it to the test by writing simple parsers. In this post, we will write a few high-level parsers - dates of the format …
Read more →
Parsing from scratch is a powerful technique that allows you to build custom parsers for your specific needs. In this series, we will explore the basics of parsing and how to implement a simple parser …
Read more →
Some astute readers of the previous post on builder pattern highlighted the verbosity of the pattern. The builder pattern is a powerful pattern but comes with the baggage of boilerplate code. One even …
Read more →
Bahul and I gave a talk about a PII logging library solution in the Bay Area Scala meetup.
Read more →
This is a post-credits bonus post that shows the complete and finished builder code.
Read more →
While the builder pattern is a powerful tool for creating complex objects in a type-safe manner, it is easy to discard it given its complexity and boilerplate. This post details the situations where …
Read more →
This post takes the ideas from previous posts to get rid of some boilerplate, and concluding the “how” portion of the series.
Read more →
This post adds type-level ordering to the builder, enforcing when fields can be set. It introduces explicit constraints on configuration order: host/port first, maxConnections/connectionTimeout before …
Read more →
This post makes the builder API more flexible by allowing incremental health check additions without losing type safety. We will see how withHealthChecks is changed from replace to append, so calls …
Read more →
This post talks about making the error messages cleaner and clearer. You might want to read this one since it involves typeclasses. 😉
Read more →
This post extends a prior typesafe Builder Pattern and demonstrates where it breaks down with a more complex AppConfig[F[_]] that wires Auth, Users, Books, and multiple HealthChecks. It presents a …
Read more →
The Builder pattern provides a way to construct complex objects step by step with a fluent API, where each method call returns the builder itself, allowing for method chaining. Let us play some type …
Read more →
A contramap is defined as the converse of the map. I have never been satisfied with the definition. In this post, I will explain the concept in a way that is easy to internalize.
Read more →
This post provides a concise overview of key symbols used in Scala 2, such as symbols for function types, function literals, import renaming, and more. It serves as a quick reference for Scala …
Read more →
Recently, someone quizzed me to write a JSON parser. Time was limited. So, I told them I might not be able to write a disciplined parser that builds an AST and creates JSON objects out of it. In the …
Read more →
This post explores a functional style implementation in Scala and Java to a famous interview question to find the top k frequent items in an array. Beware the functional implementation may not be …
Read more →
This post explores the similarities between Kotlin and Scala, two modern programming languages. The post highlights key programming constructs, demonstrating how both languages handle basic syntax, …
Read more →
Guest post by Bahul Jain. In this post, he talks about algebraic data types (ADTs) and its benefits. He discusses how ADTs can be used to model complex data and boost developer productivity.
Read more →scala-cli, one of the superpowers in the Scala ecosystem, is a versatile tool for running Scala scripts. It has a ton of options to play with. One of the arguments you can pass to scala-cli is to …
Read more →This post takes a more relatable and realistic yet complex problem to demonstrate how it is straightforward and concise to implement it in functional programming. It makes the case why functional …
Read more →
Guest post by Bahul Jain. In this post, he talks about addressing the performance implications of creating types everywhere. He explores AnyVal and a light-weight library called Supertagged to …
Read more →
Guest post by Bahul Jain. In this post, he explains why types are essential for modeling data and operations in a meaningful way. He goes into detail about how types help clarify the purpose of data, …
Read more →A friend raised a great question after reading the last post: If I am reading a list of books (List[Book]) from the database, wouldn’t I lose the type information augmented by phantom type? If …
Read more →Making illegal states irrepresentable is a powerful technique in (functional) programming. The technique constrains certain operations to specific states, preventing your code from compiling if you …
Read more →
This post is the final part of the series on SBT. I hope I covered everything needed to break the ice and change the perspective on SBT. I have touched on most ingredients you need to write a decent …
Read more →
I had planned to finish the series with this post. But Plugin s wouldn’t let me. I am going to show you how to write/publish a SBT project that is a Plugin, and I will show a nifty trick. It is …
Read more →
So far, we have everything we need to write the build definition for a single project. Today, we’ll see another powerful feature of SBT: Multi-module builds.
Read more →
Previously, we discussed Plugin s. Today, let us see how to better organize build code. How I SBT - build.sbt How I SBT - Settings & Tasks How I SBT - Plugins How I SBT - Build Code Organization …
Read more →
Previously, we discussed how to quickly write a simple build.sbt without fuss. We briefly understood how it is processed by SBT along with Settings and Tasks. We did that without having to know about …
Read more →
Previously, I showed you how to write a SBT build definition without knowing much at all. Neither did I talk about simple things like directory structure nor about advanced things like scope or axis, …
Read more →Interpreter is a language (or program) to evaluate expressions and execute code. The intent is to keep the evaluation lazy and pure. There are 3 different kinds of methods in the interpreter pattern / …
Read more →
Collection of nifty Scala things Monad Laws Interpreter Basics … and more
Read more →
Contrary to the unpopular opinions that it is hard and clumsy, SBT, the de facto build tool for Scala, is one of the best. Ease comes with familiarity. Unfortunately, there aren’t many …
Read more →
Last time, I wrote about different ways of declaring implicits, which is a prelude to this post. Knowledge of different ways of declaring implicits is good for general understanding on the subject, …
Read more →Recently, I had to cross-compile a bunch of Scala library repositories for JDK 11 and JDK 17. I was hoping SBT would natively support specifying the related configuration in build.sbt similar to …
Read more →While implicits are easy to use, declaring them properly requires careful consideration. Because there are a few different ways you can declare implicits viz. extension methods, parameter values, type …
Read more →Monad typeclass trait Monad[F[_]]: def pure[A](a: A): F[A] def flatMap[A, B](fa: F[A])(f: A → F[B]): F[B] Monad Laws pure(a).flatMap(f) = f(a) m.flatMap(pure) = m m.flatMap(g).flatMap(h) = m.flatMap(b …
Read more →
I have been reading the My Scala Story series by Software Mill - a short interview of renowned experts about their Scala journey. I have not done anything substantial in the OSS space to be on …
Read more →The billion dollar mistake has been committed already. No going back. But it is not necessary to keep repeating it. Oh, I am talking about the infamous null. Would Java’s Optional come to the …
Read more →