如何在 cabal / stack 中添加 CPP 定义?

How do I add a CPP defininition within cabal / stack?

我正在查看以下模块:https://hackage.haskell.org/package/boxes-0.1.4/docs/src/Text-PrettyPrint-Boxes.html

其中包含以下内容:

module Text.PrettyPrint.Boxes
    ( -- * Constructing boxes
#ifdef TESTING
      Box(Box, content)
#else
      Box
#endif

如何启用/定义 TESTING 值 - 用于开发目的?理想情况下,我希望在 GHCi 会话中构建/启用它。

我必须纠正自己 - 我给出的评论是完全错误的。

> git clone git://github.com/treeowl/boxes.git
> cd boxes
> stack init
> stack ghci --ghc-options=-DTESTING
split-0.2.3.2: using precompiled package
boxes-0.1.4: configure (lib)
Configuring boxes-0.1.4...
boxes-0.1.4: initial-build-steps (lib)
Completed 2 action(s).
Configuring GHCi with the following packages: boxes
GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from ...
[1 of 1] Compiling Text.PrettyPrint.Boxes ( .../boxes/Text/PrettyPrint/Boxes.hs, interpreted )
Ok, modules loaded: Text.PrettyPrint.Boxes.
Loaded GHCi configuration from /tmp/ghci28386/ghci-script
*Text.PrettyPrint.Boxes Text.PrettyPrint.Boxes> :t content 
content :: Box -> Content

工作正常。