concept functional programming in category dsl

This is an excerpt from Manning's book DSLs in Action.
Figure 6.3. With Scala you can use the dual power of OO and functional programming to evolve your domain model. Using the OO features of Scala, you can abstract over types and values, specialize a component through subtyping, and do composition using mixins. You can also use the functional features of Scala through its higher-order functions, closures, and combinators. Finally, you can compose all of this using modules and get your final abstraction.
![]()
With basic background information about external DSL implementations already served up in chapter 7, we’re going to jump directly into parser combinators. Parser combinators are one of the most beautiful applications of functional programming. They offer an internal DSL to use for designing external DSLs so you don’t have to implement your own language infrastructure as you do with other techniques of external DSL design. When we designed an external DSL for processing client orders in chapter 7, remember that we used ANTLR as the parser generator. We designed our grammar for the DSL and ANTLR generated the parser for us. To design our own DSL, we had to use an external tool that provided us with the necessary language implementation infrastructure. Using parser combinators, you don’t have to step out of the host language for a second. This makes the implementation succinct, expressive, and completely free of any external dependency.