Skip to content

Instantly share code, notes, and snippets.

View jamesporter's full-sized avatar

James Porter jamesporter

View GitHub Profile
@jamesporter
jamesporter / README.md
Created August 20, 2017 21:27 — forked from busypeoples/README.md
Making Impossible States Impossible in ReasonML

Making Impossible States Impossible in ReasonML

Introduction

If you have already seen Richard Feldman's talk entitled "Making Impossible States Impossible" or have read "Designing with types: Making illegal states unrepresentable" then you can skip the explanations and just head straight to the Reason examples.

This post is intended to display how to model your Reason Application to prevent creating impossible states. The benefits of being able to design a feature in this way are avoiding having to deal with complex test scenarios when dealing with a set of business rules and a clear documentation of what is possible just by looking at the type definition. Long story short, let's see how this all works by implementing an example.

Requirements