never executed always true always false
1 {-# LANGUAGE CPP #-}
2
3 module GHC.Utils.Constants
4 ( debugIsOn
5 , ghciSupported
6 , isWindowsHost
7 , isDarwinHost
8 )
9 where
10
11 import GHC.Prelude
12
13 {-
14
15 These booleans are global constants, set by CPP flags. They allow us to
16 recompile a single module (this one) to change whether or not debug output
17 appears. They sometimes let us avoid even running CPP elsewhere.
18
19 It's important that the flags are literal constants (True/False). Then,
20 with -0, tests of the flags in other modules will simplify to the correct
21 branch of the conditional, thereby dropping debug code altogether when
22 the flags are off.
23 -}
24
25 ghciSupported :: Bool
26 #if defined(HAVE_INTERNAL_INTERPRETER)
27 ghciSupported = True
28 #else
29 ghciSupported = False
30 #endif
31
32 debugIsOn :: Bool
33 #if defined(DEBUG)
34 debugIsOn = True
35 #else
36 debugIsOn = False
37 #endif
38
39 isWindowsHost :: Bool
40 #if defined(mingw32_HOST_OS)
41 isWindowsHost = True
42 #else
43 isWindowsHost = False
44 #endif
45
46 isDarwinHost :: Bool
47 #if defined(darwin_HOST_OS)
48 isDarwinHost = True
49 #else
50 isDarwinHost = False
51 #endif