Haskellで条件コンパイルは cpp(1) が嫌ならCabalを使えと

Haskellにifdefが無い」とブチ切れてた件 (id:flalin:20101002:1286031678) の続き.

Question: The Cabal documentation suggests to use the C preprocessor on Haskell code in order to adapt to system specific behaviour. I find this ugly. Is there another way?

Answer: You can put modules with the same name and API in different directories and choose the right module using a Cabal test.
...

なるほどねぇ.まぁそれも一つの考え方か.
つい「ちょっとした場合分けがコードベース全体の中に沢山散在するときにはモジュール分けがめんどく思えるんじゃ」とか難癖を付けたくなってしまうが,それは「ややこしさ」をどこに負担させるかっていう一般論なのかもしれない.そりゃモジュールに分かれてた方が「きちんとした」解法に決まってる.