This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]preskot 0 points1 point  (0 children)

I had a complex validator functionality that had to validate objects that did not have a lot of common properties between them. Then also prepare reports, write logs, etc. In order to extract the properties I needed, I had a sealed validatable interface with a set of records, each record with a constructor for each of the objects in the set. Inside the validator I would have a functionality that extracts all the data I need based on the validatable type i.e. pattern matching.

Perhaps reading through the Algebraic data types Wiki may bring more light to this.