Pattern matching

Let's take this Username modddel again as an example :

The 'form' validationStep contains two validations : 'length' validation and 'characters' validation. The 'availability' validationStep contains only one validation : 'reserved' validation.

There are multiple pattern matching methods generated by the modddels generator.

For the abstract invalid union-case (in this example it's InvalidUsername), there are other pattern matching methods you can use to map between the different invalid-step union-cases.

Last updated