且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

功能语言中的分解(模块化)

更新时间:2023-01-15 19:16:02

Some time ago I was learning F# and wondering about the same topics, so I asked about quality open source projects to learn from.

The reason why you're not seeing anything similar to dependency injection in functional programming is that it's just "natural", because you "inject dependencies" just by passing or composing functions. Or as this article puts it, "Functional dependency injection == currying", but that's just one mechanism.

Mocking frameworks are not necessary. If you need to mock something, you just pass a "stub" function.

See also this question about real-world Scala applications.