Functional Mocking (OsloSFP edition)

Functional Mocking (OsloSFP edition)

Mocking is an infamous technique from object-oriented programming. The goal is to be able to test stateful systems in small pieces by simulating the behaviour of certain objects. The problem with mocking is that it usually requires heavyweight frameworks and clutters test code. There are countless rants on that topic, but this talk isn't one. Instead, we'll explore the functional approach in Haskell: Designing a small language supporting the desired behaviour, and then writing interpreters which can execute its semantics in various ways. Testing I/O code was never easier.

Demo code: https://gist.github.com/larsrh/5cd5652c25ec84b8852c

A1216674d5c9747bcdcc716872439137?s=128

Lars Hupel

June 23, 2015
Tweet