Introduction to Functors With Scala 3

You’ve recently started learning functional programming and have been successful in writing functions, but then something unexpected happens. A wild functor appears! What is that? Why is it here? Don’t be scared, functors are a mathematical structure that arises from category theory, and they can be found everywhere in functional programming.

Continue Reading

ADTs in Scala (Part 2: ADTs vs OO-Classes)

In my latest post I presented ADTs in Scala 3. I also created a Youtube video about it (check it out here). Since the content was longer, I split it in three parts. This is the second part. We look at the differences between classes and ADTs. We discuss: Immutability Inheritance Public and private fields Methods Pattern matching This video is an introduction to ADTs in Scala for object-oriented developers.

Continue Reading

Encoding Base58: Understanding and implementing in Scala

I recently needed to convert to and from Base58. An existing crypto library was not an option, because I just needed one function exact function. However, I could not find a suitable Scala implementation, and the algorithm in the specification was unclear. Understanding the algorithm An encoding algorithm is just a base transformation, it is the same as transforming between base 2 (binary), 16 (hexadecimal), 10 (decimal) or any other base.

Continue Reading

My thoughts after 6 months working with DAML: A Smart Contract Language

​ A smart contract is a fancy term for a “program that runs on the blockchain”. They were first introduced in the Ethereum blockchain and the idea is simple: The blockchain acts as an ubiquitous computer to run the programs (or “smart contracts”) and stores its results and current state. We can all agree on the results and current state of the program, because of the independent consesus provided by the blockchain.

Continue Reading