[Haskell-cafe] How to define CPP macro definition with stack?

PY aquagnu at gmail.com
Wed Jun 20 07:57:06 UTC 2018


Solution was found: 
https://stackoverflow.com/questions/48157516/conditional-compilation-in-haskell-submodule

Question is closing :)


20.06.2018 10:16, PY wrote:
> Hello all,
>
> I'm using conditional compilation:
>
> #ifdef BLAH
>   blahBlah
>   #endif
>
> And I want to define BLAH, but not in *.hs file. For example, with 
> `stack` option or as environment variable... How can I do it? For 
> example, `stack -DBLAH=1 build` or something else.
> I tried
>
>   stack build --flag='*:BLAH'
>
> - no effect.
>
> Also I tried
>
>   stack build --flag=my-library:BLAH
>
> and get error that my-library package does not define flag BLAH. So, 
> it's total secret for me how to make such thing (like we can do with 
> gcc, make, etc)  :-)
>
> ===
>
> Best regards, Paul
>



More information about the Haskell-Cafe mailing list