[Haskell-cafe] Solving the configuration problem with parametrized modules

Joachim Breitner mail at joachim-breitner.de
Tue Sep 6 16:33:46 CEST 2011


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.


Joachim Breitner
  e-Mail: mail at joachim-breitner.de
  Homepage: http://www.joachim-breitner.de
  Jabber-ID: nomeata at joachim-breitner.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110906/6149e052/attachment.pgp>

More information about the Haskell-Cafe mailing list