<div dir="ltr">Sumit,<br><div><br></div><div>Here's an example:<br></div><div><br>```<br>flag production<br>  default: False<br><br>Executable Foo<br>  if flag(production)<br>    cpp-options: -DPRODUCTION<br>```<br><br></div><div>I should note that while I have this mechanism in my code, I think that overall it wasn't a good choice, and I'd rather prefer parsing a command-line argument and passing it through my code in stead of having a flag like this. It makes code much harder to write, because each usage has heavy syntax of:<br><br>```<br>#ifdef PRODUCTION<br></div><div>something<br></div><div>#else<br></div><div>somethingElse<br></div><div>#endif<br>```<br><br></div><div>while instead you could just write:<br><br>```<br></div><div>if production then something else somethingElse<br>```<br><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 12, 2015 at 11:43 PM, Sumit Sahrawat, Maths & Computing, IIT (BHU) <span dir="ltr"><<a href="mailto:sumit.sahrawat.apm13@iitbhu.ac.in" target="_blank">sumit.sahrawat.apm13@iitbhu.ac.in</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Konstantine, thanks for the reply<div><br></div><div>I decide to use flags, but then the trouble is that I will need some mechanism to flag parts of the code, possibly using the CPP extension.</div><div>I wanted to know whether there is a better way. Also, does CPP allow checking cabal configure flags? The user-guide did not mention such usecases.</div></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On 13 March 2015 at 02:23, Konstantine Rybnikov <span dir="ltr"><<a href="mailto:k-bx@k-bx.com" target="_blank">k-bx@k-bx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Hi Sumit,</p>
<p dir="ltr">Documentation clearly mentions it is related to API, so don't worry with executable and feel free to use the flags (still, depending on what are you doing, flags might not be the best solution).</p>
<div class="gmail_quote">12 бер. 2015 18:40, користувач "Sumit Sahrawat, Maths & Computing, IIT (BHU)" <<a href="mailto:sumit.sahrawat.apm13@iitbhu.ac.in" target="_blank">sumit.sahrawat.apm13@iitbhu.ac.in</a>> написав:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hi everybody,<div><br></div><div>I am looking for the correct way to provide additional functionality using cabal configure flags.</div><div>Even though the developer faq [1] says that it is not recommended, I don't see any downsides for an executable package.</div><div><br></div><div>Is it 'not recommended' even for executable packages? If not, then how can I do it?</div><div><br></div><div>[1]: <a href="https://wiki.haskell.org/Cabal/Developer-FAQ" target="_blank">https://wiki.haskell.org/Cabal/Developer-FAQ</a><br><div><div><br></div>-- <br><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div>Regards</div><div dir="ltr"><div><br></div><div>Sumit Sahrawat</div></div></div></div></div></div></div>
</div></div></div>
<br></div></div>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div>Regards</div><div dir="ltr"><div><br></div><div>Sumit Sahrawat</div></div></div></div></div></div></div>
</font></span></div>
</blockquote></div><br></div>