I often need to make a core function that\'s used in many places somehow configurable - i.e., it may use either algorithm A or algorithm B depending on a command-line switch; o
Our new HFlags library is exactly for this.
If you would like to see an example usage like your example, look into this:
https://github.com/errge/hflags/blob/master/examples/ImportExample.hs
https://github.com/errge/hflags/blob/master/examples/X/B.hs
https://github.com/errge/hflags/blob/master/examples/X/Y_Y/A.hs
No kind of parameter passing is needed between the modules, and you can define new flags with an easy syntax. It uses unsafePerformIO internally, but we think that it does that in a safe way, and you won't have to concern yourself with that.
There is a blog post about this stuff at: http://blog.risko.hu/2012/04/ann-hflags-0.html