Since I always keep mixing up the names of morphisms, I finally created a cheat-sheet that now in its full glory decorates my office. The important part of the poster is, that it puts morphisms that deconstruct data (left column) with those that construct codata (right column) in contrast. So on one glance you can see that zygomorphisms are obviously dual to g-apomorphisms — of course, that’s an easy one.
This week I was faced with the problem of abstracting over two functors like
F1[O] = Int × O and
F2[I, O] = (I => Int) × (I => O). Both look very similar,
but not similar enough – so I had to repeat the functor with the slight
changes over and over again. Then I came up with a solution…
A few days ago I stumbled apon Paul Phillips awesome talk “Inside the Sausage Factory” – explaining some internals of the Scala compiler. In his talk he mentions that he does not like using
Option since it is “tedious and syntax heavy”. He suggests to use the “null object pattern” – creating a “distinguishable object to server the role of none”.
A problem with this approach is that one looses all the nice methods
Option provides such as
map. In this post we will see how we can get the best of both worlds by using implicits.
During this winter break I decided to jump into developing an alternative Scala wrapper for the Java Framework Vaadin. Many parts of the API are dealing with measurements like pixels or cm, so having a good design for handling measurements is crucial. In this post we first develop an API on the termlevel and then shift parts of the validation to the typelevel using a typeclass encoding.
Working on some project I noticed myself using the memoization pattern many times to create lazy evaluated properties. With ES5 a new way of implementing lazy attributes becomes available, preserving the interface of an attribute.
I didn’t think I will ever write about homework assignments, but this one was too cool. The task: “Write a wrapper class for collections, that reifies all operations on it.” In other words, queries on the collection should be available as AST in order to perform optimizations on them. This post is about one small problem related to the task.