Skip to content

Commit 3d98471

Browse files
committed
treewide: clean-up of #ifdef macros
This type of #ifdef use is undocumented. It can be explained as IF Cabal env does not load/link the package, then Cabal does not provides this variable `MIN_VERSION_serialise` So this expression determines is package provided by Cabal. b60a15d Which was done to not load serialize for GHCJS build: ba0dc19 (look at the `.cabal` `!impl` `GHCJS` switch) So this macros can be reduced now. Yeeting `datasize` circa 2016.
1 parent 73d6505 commit 3d98471

File tree

5 files changed

+1
-23
lines changed

5 files changed

+1
-23
lines changed

src/Nix/Effects.hs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,9 @@ class
105105
instance MonadIntrospect IO where
106106
recursiveSize =
107107
#ifdef MIN_VERSION_ghc_datasize
108-
#if MIN_VERSION_ghc_datasize(0,2,0)
109108
recursiveSize
110109
#else
111-
\_ -> pure 0
112-
#endif
113-
#else
114-
\_ -> pure 0
110+
\_ -> pure 0
115111
#endif
116112

117113
deriving

src/Nix/Effects/Basic.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ import Nix.Value
3131
import Nix.Value.Monad
3232

3333
#ifdef MIN_VERSION_ghc_datasize
34-
#if MIN_VERSION_ghc_datasize(0,2,0)
3534
import GHC.DataSize
3635
#endif
37-
#endif
3836

3937
defaultMakeAbsolutePath :: MonadNix e t f m => FilePath -> m FilePath
4038
defaultMakeAbsolutePath origPath = do

src/Nix/Exec.hs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,11 @@ import Nix.Value
4343
import Nix.Value.Equal
4444
import Nix.Value.Monad
4545
import Prettyprinter
46-
#ifdef MIN_VERSION_pretty_show
4746
import qualified Text.Show.Pretty as PS
48-
#endif
4947

5048
#ifdef MIN_VERSION_ghc_datasize
51-
#if MIN_VERSION_ghc_datasize(0,2,0)
5249
import GHC.DataSize
5350
#endif
54-
#endif
5551

5652
type MonadCited t f m =
5753
( HasCitations m (NValue t f m) t
@@ -514,11 +510,7 @@ addTracing k v = do
514510
if verbose opts >= Chatty
515511
then
516512
pretty $
517-
#ifdef MIN_VERSION_pretty_show
518513
PS.ppShow $ void x
519-
#else
520-
show $ void x
521-
#endif
522514
else prettyNix $ Fix $ Fix (NSym "?") <$ x
523515
msg x = pretty ("eval: " <> replicate depth ' ') <> x
524516
loc <- renderLocation span $ msg rendered <> " ...\n"

src/Nix/Render/Frame.hs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ import Nix.Value
2626
import Prettyprinter hiding ( list )
2727
import qualified Text.Show as Text
2828
import Text.Megaparsec.Pos ( sourcePosPretty)
29-
#ifdef MIN_VERSION_pretty_show
3029
import qualified Text.Show.Pretty as PS
31-
#endif
3230

3331
renderFrames
3432
:: forall v t f e m ann
@@ -153,11 +151,7 @@ renderExpr _level longLabel shortLabel e@(AnnE _ x) = do
153151
opts :: Options <- asks (view hasLens)
154152
let rendered
155153
| verbose opts >= DebugInfo =
156-
#ifdef MIN_VERSION_pretty_show
157154
pretty (PS.ppShow (stripAnnotation e))
158-
#else
159-
pretty (show (stripAnnotation e))
160-
#endif
161155
| verbose opts >= Chatty = prettyNix (stripAnnotation e)
162156
| otherwise = prettyNix (Fix (Fix (NSym "<?>") <$ x))
163157
pure $

src/Nix/String/Coerce.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ import Nix.Value
1212
import Nix.Value.Monad
1313

1414
#ifdef MIN_VERSION_ghc_datasize
15-
#if MIN_VERSION_ghc_datasize(0,2,0)
1615
import GHC.DataSize
1716
#endif
18-
#endif
1917

2018
-- | Data type to avoid boolean blindness on what used to be called coerceMore
2119
data CoercionLevel

0 commit comments

Comments
 (0)