It is somehow shared knowledge among Haskellers that applicatives allow performing static analysis, while monads do not. But what does it mean in practice? And what kind of static analysis is this referring to? The best answer I could find online is this answer on StackOverflow. In this post I’d like to expand on it a bit and take the concept a bit further 1 . Contextual interface Consider an…
Haskell is a programming language well known for its usage of monads and for the over-abundance of tutorials trying to explain them . This is not one of those posts. On the other hand, in this post I’ll try to convince you that Haskell without monads (as a main concept) is not only possible, but maybe also a good idea. This post is heavily inspired by the post Exploring Arrows for sequencing…
In this post I’d like to try to discuss what functional optics are, without going too much into why they are so cool, and you should use them, or how they are implemented 1 and should be used with a specific language and library. I personally think that functional optics should be a really easy concept to grasp, but currently learning them is harder than it should be mostly due to library…
When we think about interfaces in software development, it’s easy that our thoughts go the interface keyword used in many Object-Oriented languages like Java and C#. But interfaces are a much more general concept, and they could be defined as: an interface is a shared boundary across which two or more separate components of a computer system exchange information Wikipedia Even restricting to the…
When we are writing our beautiful code we often need to deal with dependencies, might they be tools, libraries, or simply other code we wrote some time ago. Choosing to use a dependency usually comes with its own set of tradeoffs and constraints. For example using a relational or a non-relational database might guide us to design our persistence-level data types in different ways. Or using time or…
One of the aspects which sets Haskell apart from other programming languages is that we tend to handle our effects with care. We are used to using monads to encode side effects; for example we use Either e to encode failures, Reader r to describe configuration and State s for stateful operations. This introduces the issue of combining multiple effects needed in the same computation. Many solutions…
Since I started learning DDD and Event Sourcing in particular, I was always fascinated by the picture that explains everything by Alberto Brandolini . It describes an high level perspective on how to model domains using the elements of event storming. Briefly, it proposes to structure the flow of an application in the following fashion: a user requests to the system the execution of a command . an…
Either is one of the easiest data structures which can be used to make your code safer and more composable. It is not particularly complex but sometimes it is still hard to grasp, especially for programmers used to a procedural or object oriented approach. In this post I’ll try to give an explanation on the benefits of using the Either data structure, both from a theoretical and from a practical…
Soisy is an Italian startup working in the fintech sector, providing a payment by instalments system to affiliated e-shops. Some months ago the need to release a new version of our risk engine emerged, so we started considering how to actually build it. The decision we took was to use Haskell . In this post we will try to summarise our path, from the initial situation and the perplexities around…