The CPP extensions allows conditional compilation, e.g.
{-# LANGUAGE CPP #-}
#ifdef DEBUG
-- some debug code
#endif
It works fine, of course, but it's quite clumsy and non-idiomatic. Is there really no other mechanism to achieve conditional compilation?
(The specific case where I really would like to use it is the Text.Megaparsec.Debug.dbg function. The parse trail it produces is really useful, but the source code gets littered with #ifdef...#endif noise which makes it all rather unreadable. A wrapper function at the top would remove most of the noise, but I'm wondering nonetheless.)