To create a Cabal project using GHC or Haste, use the cabal binary for the former and haste-inst (comes in a hurry) for the latter.
To have conditional code in your modules, add {-# LANGUAGE CPP #-} and use #ifdef __HASTE__ , which will be determined only by haste, but not by GHC. Note that __GLASGOW_HASKELL__ is defined in both cases (which makes sense since rush builds on GHC for large parts of compilation). Therefore you would use it as
{-# LANGUAGE CPP #-} module Module where compiler :: String #ifdef __HASTE__ compiler = "haste" #else compiler = "GHC" #endif
Theoretically, for conditional settings in the Cabal file, something like this should work:
library exposed-modules: Module if impl(ghc) exposed-modules: Module.GHC if impl(haste) exposed-modules: Module.GHC build-depends: base ==4.6.*
but it seems that even with haste-inst , impl(ghc) true; error report .
source share