
Hello, Am Dienstag, den 06.09.2011, 15:17 +0300 schrieb Yitzchak Gale:
We're talking about passing a single parameter - a record type, or a shallow tree, or something else extremely simple. In the monadic case, we're adding a single Reader component to the transformer stack.
point taken, if you are already building on a transformer stack, adding yet another layer is not a problem. I’m having mainly pure code in mind.
Also, I expect that the explicit passing causes a small performance penalty.
We're been processing gigabytes of data - doing non-trivial operations including a kind of image recognition and more - so far with nearly imperceptible delay. The bottleneck, if there is one, will certainly not be the configuration subsystem.
Hmm, maybe I am underestimating ghc, but I’d expect that while it could create very good code for some tight recursion loop in the IO monad, I’m not so confident that it could do that for a recursion in (ReaderT IO) or an even more complex monad stack. But you are right, other than this special case, the performance issues are surely not in setting parameters.
What case are you thinking about? A system several orders of magnitude more complex? Some special case that creates difficulty?
I think the benefit you get from being able to treat runtime constants as plain values manifests mostly when writing pure code. If your code has already been written or re-written in monadic style, adding a transformation layer is indeed less of a problem. Greetings, Joachim -- Joachim Breitner e-Mail: mail@joachim-breitner.de Homepage: http://www.joachim-breitner.de Jabber-ID: nomeata@joachim-breitner.de