Domo is an #elixir library to model a business domain with type-safe structs and composable tagged tuples.
It's a library to define what piece of data is what and make a dialyzer and run-time type verification to cover one's back, reminding about taken definitions.
The library aims for two goals:
-to allow a business domain entity's valid states with a struct of fields of generic and tagged types
- to automatically verify that the construction of the entity's struct leads to one of the allowed valid states only
The validation of the incoming data is on the author of the concrete application. The library can only ensure the consistent assembly of that valid data into structs according to given definitions throughout the app.
https://github.com/IvanRublev/Domo
Both ids for User and Order structs are of the integer type. How to ensure that we don't mix them up throughout the various execution paths in the application? One way to do that is to attach an appropriate tag to each of the ids with tagged tuple like the following:
Post #576
2.46K