Journey to an FP Test Harness – Justin du Coeur (Mark Waks)
Channel: Typelevel
Date: 2019-05-03

The hardest part of the pure-FP journey for many people is taking that first real step. Even after you’ve read all the books and done all the exercises, you need to start committing real code to truly grok the FP mindset.

This little case study will trace my journey over that line, in building a new test harness to an existing Play application. In the course of it, we’ll explore how my assumptions evolved:

    From stateful members to consistent use of StateT;
    From Play’s native Future-centricity to IO;
    Becoming a little more nuanced about test state using IndexedStateT;
    Moving away from an ever-growing cake to focus on imports instead;
    And the payoff, being able to refactor the test code to be modular, readable and robust.

The goal here is to show that, while there are a bunch of parts, none of this is rocket science. In the end, the resulting code is delightfully elegant, and the general approach should work for many Play applications.

* Material *

Slides: https://slides.com/jducoeur/fptestjourney#/

* Event *

Typelevel Summit Philadelphia, April 2019: https://typelevel.org/event/2019-04-summit-philadelphia/

* About Speaker *

I’m a second-generation programmer, starting out on my father’s PDP-8 back in the mid-70s, and I’ve been a language geek ever since, working professionally in everything from LISP to Ada to assembly to C# to JavaScript to C++ to (heaven help me) COBOL, and pretty much everything in between. I picked up Scala back in 2007 (after trying to build a company in Java and winding up in a rage over its limitations); I’ve been working in Scala full-time since 2012. I’ve been doing “light FP” since picking up the style from Ruby around 2002, but am just now getting into the pure stuff. During the day, I work at Artima, doing Scala training and consulting and helping with ScalaTest. In my spare time, I’m the CEO and Architect of Querki, a wiki/database hybrid designed to make it easier for individuals and communities to manage and collaborate on their data.

* Licensing *

This recording is licensed under CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/).