Refined types for validated configurations – Viktor Lövgren
Channel: Typelevel
Date: 2017-07-06

Are you tired of writing boilerplate code to load configurations? Have you ever had errors because of bad configuration values? Then this talk is for you! In a live-coding session we’ll see how to encode validation rules on the type-level and load validated settings without any boilerplate code.

In the first part of this talk we’ll look at the challenges associated with loading configurations. We’ll see how typesafe config is typically used, and see how we can eliminate most boilerplate code with Typelevel incubator project PureConfig. We’ll however see that it’s still very much possible to load invalid settings.

In the second part we’ll continue by exploring options to encode type invariants, for enforcing validation, looking at how we can get PureConfig to only load validated settings. We’ll ultimately end up with type-level predicates using Typelevel project refined, and see how we can get PureConfig and refined to work together seamlessly.

The end result is more precise types, with static validation guarantees, and a way of loading validated configurations without boilerplate – finally you can stop worrying about your configurations!

* Material *

Slides: https://vlovgr.github.io/refined-types/

* Event * 

Typelevel Summit Copenhagen, June 2017: http://typelevel.org/event/2017-06-summit-copenhagen/

* About Speaker *

Viktor is a Software engineer at Ovo Energy in London, working on the platform powering energy meter readings and consumption data. He’s an advocate of strongly typed functional programming, and Scala in particular, which has been his professional focus the past three years.

* Licensing *

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