Menu

Optimizing Tagless Final – Saying farewell to Free

The Tagless Final encoding has gained some steam recently, with some people hailing 2017 as the year of Tagless Final. Being conceptually similar to the Free Monad, different comparisons have been brought up and the one trade-off that always comes up is the lack or the difficulty of inspection of...

Announcement: cats 1.0.0

The cats maintainer team is proud to announce the cats 1.0.0 release. Cats has been striving to provide functional programming abstractions that are core, modular, approachable and efficient. Cats 1.0.0 marks the point where we believe that our API is robust and stable enough to start guarantee backward binary compatibility...

Who implements the typeclass instance?

The typeclass pattern in Scala invites you to place implementation-specific knowledge directly in the typeclass instances, with the interface defined as the typeclass’s abstract interface. However, GADTs permit a different organization of code. It is even possible to define a typeclass that seems to do nothing at all, yet still...

There are at least three types of strings

Newtype mechanisms are a great way to introduce wrapper-free, global distinctions of “different” instances of the same type. But we can do that on a local level, too, by using type parameters. Consider these two signatures. def mungeIDs(uids: List[String], gids: List[String], oids: List[String]): Magic[String, String, String] def mungeIDsSafely[UID <: String,...

Announcement: cats 1.0.0-MF

The cats maintainer team is proud to announce the cats 1.0.0-MF release. MF stands for milestone final, this will be the last release before cats 1.0.0-RC1 which will be followed by cats 1.0 shortly. The main purpose/focus of this release is to offer a relatively stable API to work with...

Validated Configurations with Ciris

The need for configuration arises in almost every application, as we want to be able to run in different environments – for example, local, testing, and production environments. Configurations are also used as a way to keep secrets, like passwords and keys, out of source code and version control. By...

Compile time dimensional analysis with Libra

Dimensional analysis When we code, we code in numbers - doubles, floats and ints. Those numbers always represent real world quantities. For example, the number of people in a room can be represented as an integer, as can the number of chairs. Adding people and chairs together gives a nonsensical...

An IO monad for cats

Haskell is a pure language. Every Haskell expression is referentially transparent, meaning that you can substitute that expression with its evaluated result without changing the program. Or, put into code: -- this program f expr expr -- apply function f to arguments expr, expr -- is equivalent to this one,...

Equivalence versus Equality

This is a guest post by Tomas Mikula. It was initially published as a document in the hasheq. It has been slightly edited and is being republished here with the permission of the original author. This article describes what we mean when we say that the data structures in this...

Four ways to escape a cake

The mixin style of importing in which classes and traits are defined within traits, as seen in scala.reflect.Universe, ScalaTest, and other Scala styles, seems to be infectious. By that, I mean once you define something in a trait to be mixed in, to produce another reusable module that calls that...