Nachdem im ersten Teil einige Catamorphismen vorgestellt wurden, die mit rekursiven Datenstrukturen arbeiten, beschäftigen wir uns nun erstmal mit dem Gegenteil. Ein Anamorphismus verwendet eine CoAlgebra von Typ a -> f a
, um eine Datentypen aufzubauen. Damit habe ich es auch eilig, denn ich bin es leid, mir Testdaten stets mühselig im Stile von Node 3 (Leaf (Node 4 Leaf Leaf))
aufzubauen.
Seit geraumer Zeit bin ich fasziniert von “recursion schemes” und habe mich in Scala und nun auch in Haskell mit ihnen beschäftigt. Aber was sind “recursion schemes” und worin liegt für mich ihre Faszination?
The last episode of this series covered the motivation behind Monad Transformers and gave some examples of their usage. Now it is time to show a small real world application. By chance I stumpled accross this section of code in an open source project:
Let’s say you are a typical scala programmer, making plenty of use of Future
s in your code. Sooner or later you end up having APIs like the following:
I found a post by Qiaochu Yuan that has the following definiton: A comathematician is a device for turning cotheorems into ffee.
Apparently this is a very funny joke. Could someone explain it to me and tell me where I could learn about the subject in question? Thank you very much in advance.
Today we talk about the little wiggly operator |@|
. Being slightly deaf and one of the few living persons on this planet who never watched a Star Wars movie, I always thought people call this the allah al akbar
operator, when in fact it is called the Admiral Ackbar
operator. If you haven’t so far, please read the post about Applicatives as this blog post builds on top of it.
In the last installation of this series, we covered the Functor and now we take a turn to discuss the Applicative
type class.
In the last installation of this series, we covered the Foldable and now we take a turn to discuss the Functor
type class. Basically we cover some building blocks out of which more complex type classes can be build.
In the last installment of this series, we had a look at one of the most primitive type classes, the semigroup. Today we add one nifty feature to it, namely the notion of an identity element zero
:
trait Monoid[A] extends Semigroup {
def zero : A
}
Almost immediately when I started to program in Scala, I became intruiged by scalaz
, the scala type class library. After playing and learning a bit, I decided that I essentially rewrite the library to get a better understanding of its concepts. I do not intend to replace scalaz, I skip lots of the optimization techniques, and left out many of the “non essential functions”. Gradually I will blog about the experiences and compile a tutorial much in the style of the essential Learning scalaz by Eugene Yokota.