Pavel
Pavel

Reputation: 5662

GHC Haskell compile-time constants

I'm setting up a build system for my Haskell project and would like to build both debug and release versions without modifying the code every time. In other words, I am looking for something similar to GCC's -D flag so that I can have a certain value be False by default and True if that flag is passed to GHC. If the value is True, the app will use the production environment instead of dev.

I could have the environment switch be either on the command-line or test for the presence of a file, but this is not ideal.

What can you guys recommend?

Thanks :-)

Upvotes: 2

Views: 423

Answers (1)

jberryman
jberryman

Reputation: 16645

C pre-processor macros might get you what you need, especially if you are using cabal as your build system. See this old question

Upvotes: 7

Related Questions