HackerTrans
热门最新趋势评论往期问答秀出招聘

waluigi

no profile record

评论

waluigi
·8年前·讨论
The way I would approach this is to write what essentially amounts to a declarative specification of what computation needs to be run, and then define an interpreter that handles the caching of intermediate values.

The "Embedded DSL + Interpreter" pattern is incredibly powerful, and it's nice to see it catching on more.
waluigi
·8年前·讨论
Monad Transformers aren't _that_ bad, the MTL style of doing things makes it all pretty painless.

It also provides a huge opportunity for testing. At a very high level, you describe all of your effects as a series of embedded, compostable DSLs that you define interpreters for. The awesome part is that you can switch out the interpreters at will, so you can, for example, replace something that handles network requests with something that returns dummy data almost effortlessly.