
On 11/20/2015 12:19 PM, martin wrote:
Am 11/20/2015 um 10:31 AM schrieb Tom Ellis:
On Fri, Nov 20, 2015 at 10:18:46AM +0100, martin wrote:
(++) is only used in the Wtrs themselves, but these are only called when I am actually logging something, which is only a handful of lines. Adding an mempty Logger does not change the number of lines written but does change the execution time. So I don't think this is it.
Surely every call logs *something* even if it's []?
Not really. If nothing gets logged, then my loggers return the original log. There is no (++) involved, not even a ([] ++ log). The cost should only be the cost of checking the condition.
Even for mempty, you're still recursively mappending the "tails" of the loggers. How about introducing a designated constructor for mempty to avoid that recursive mappend? (The same constructor will be used when a logger is "done" and is known not to produce any further output.) Roman