Conditional compilation based on interactive (GHCi) or compiled

Is there a way to use CPP to compile different versions of some code based on whether we are in ghci or compile the code? Alternatively, conditional compilation based on enabling optimization might work.


source to share

1 answer

You can use pragma RULES

. They only fire when optimization is enabled. A simple pragma replacing one binding with another will only allow you to change the definition of something when you enable optimizations, although this still requires compiling both versions all the time.

This is not a great solution, but I think it is not a good thing to do either.



All Articles