Another Small Example of the Type Class Pattern

Some guys at work wanted to know what was going on in this code:

import scalaz._
import Scalaz._
val x: Option[Int] = whatever
val y = ~x // Huh!?

[...]

Posted in Scala, Small Examples | Comments Off

TDD Regex Kata

For the past couple of years, we have been using an exercise in various of the training courses we lead, the purpose of which is to show that maintaining too narrow a view during TDD can lead to a very degenerate process and results.
[...]

Posted in Uncategorized | Comments Off

A Small Example of Kleisli Arrows

This is a simple example of use of a mysterious beast called a Kleisli arrow.
[...]

Posted in Scala, Small Examples | 6 Comments

A Small Example of Phantom Types (with covariance thrown in)

Here is an example of so-called phantom types and covariance in Scala to improve type safety and correctness. The example is a simplified version from a real project.
[...]

Posted in Scala, Small Examples | Comments Off

A Small Example of the Typeclass Pattern in Scala

Typeclasses, (or type classes), are most famously a language feature of Haskell that has gained interest in the Scala community. Here I describe the basic pattern with references for further study.
[...]

Posted in Scala, Small Examples | 1 Comment

Flattening the Loan Pattern

The loan pattern is a common pattern for working with resources that should be closed or otherwise managed after use. It removes responsibility from the developer to manage a resource properly. When loaning several objects, one often ends up with nested functions. Here is a way to flatten that to make things clearer.
[...]

Posted in Scala, Small Examples | Comments Off

A Small Example of Applicative Functors with Scalaz

I recently blogged about Functors and mentioned a mysterious beast called Applicative Functor. Here is a simple, complete example that shows how you can use Applicative Functors with the Scalaz library, with references for further reading.
[...]

Posted in Scala | Comments Off

A Small Functor Example

In the world of functional programming you will quickly come across the concept of a Functor. What I present below is a simple example that might provide some intuition, with references for further reading.
[...]

Posted in Scala, Small Examples | Comments Off

A Successful Delivery

Over the last few months, we’ve been working on delivering HSBC’s Clearing Connectivity Layer and OTC Cleared Trade Acceptance System. We went live early December, and in fact, we delivered our first release early.

[...]

Posted in Casual Miracles, Scala, Software Process | Comments Off

A Small Example of the Scalaz IO Monad

I wanted a very tiny example of using the IO Monad in the brilliant Scalaz library, and here it is.

[...]

Posted in Scala, Small Examples | 5 Comments