Principles, Best Practices and Design Patterns for functional programming

后端 未结 7 1504
我在风中等你
我在风中等你 2021-01-31 09:56

Are there any known principles, best-practices and design patterns that one can follow while writing code in a functional programming language?

相关标签:
7条回答
  • 2021-01-31 10:51

    Why Functional Programming Matters by John Hughes gives good motivation for why laziness and higher order (first class) functions provide a lot of what less functional languages are missing and supplement with design patterns.

    In the context of Haskell, I thought the book Real World Haskell had some good and practical advice about idioms and abstraction and type classes and the like. The Typeclassopedia is also always useful. The core, very abstract type classes could be looked at as design patterns except they are enforced by the compiler/type system and part of the language (if you learn how to use them).

    In the context of Lisp, Paul Graham wrote a book called On Lisp (available online) where he shows that functional languages are ideal to create a custom programming language and then write your program in that. So embedded domain specific languages themselves are a sort of design pattern.

    0 讨论(0)
提交回复
热议问题