HackerTrans
TopNewTrendsCommentsPastAskShowJobs

waluigi

no profile record

comments

waluigi
·8 năm trước·discuss
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 năm trước·discuss
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.