Interestingly I just found this in Scott’s preface to his book “Domain modelling made functional”:
"This book focuses on the ‘mainstream’ way of doing domain modeling, by defining data structures and the functions that act on them, but other approaches might be more applicable in some situations. I’ll mention two of them here in case you want to explore them further:
If the domain revolves around semistructured data, then the kinds of rigid models discussed in this book are not suitable and a better approach would be to use flexible structures such as maps (also known as dictionaries) to store key-value pairs. The Clojure community has many good practices here."
Even complex SPAs would likely be considered mainstream by most, including Scott.
The other thing about the philosophical approach of DDD is that it approaches software design from the business first at a very fundamental level. I just read how a dynamic language programmer appreciated just being able to dive into starting to code without needing to think about and define types at this early stage. This is definitely not a DDD approach and I think this is where the rigidity of concrete algebraic types is not a disadvantage but are an advantage. Adding the ease in which code can be safely and quickly refactored in Elm further reduces the seeming disadvantage of the rigidity of an algebraic type system.
One question is could something like a map system be used with an algebraic type system? How complementary would they be? I guess Record Aliases are a kind of map but perhaps a map based modelling system is so fundamental to the language as to be entirely different and incompatible with the idea of Maps with Types (either containing types or being contained by types). I’m wondering if Typeclasses are an attempt to solve some of the rigidity of algebraic types, albeit in a very different way.
The thing that Rich seemed to also indicate was that maps handle highly nested data quite easily.
It’s a fascinating topic.