Functional Design and Architecture by Alexander Granin #BookSummary

Domain modeling with Free monads

  • Interfaces are used to handle complexity and communicate the essence of a business domain.
  • Free monads are the most idiomatic functional interface and have interesting parallels with OOP interfaces.
  • The Free monad pattern is a powerful and convenient way of designing eDSLs.
  • The Free monad is a template for wrapping eDSLs to make them monadic and sequential, which is better than being list-based.
  • Free monads allow for the nesting of languages and chaining of scripts of different types while resolving the "returning" problem, making the code more usual and easier to compare.
  • Based on the domain properties, design a set of domain languages in a form that’s more suitable and natural for expressing user scenarios.
  • If your domain is supposed to have some imperative-like operations, or if you’d like to design your domain in a such way for some reason, consider wrapping your eDSLs into Free monads.
  • GADTs is a weaker design pattern than Free monads for making domain-specific languages.
  • GADTs are a genericity-like abstraction while Free monads are an interface-like abstraction.

#Booksummary

#WeekReading

Credit : Manning


To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics