summaryrefslogtreecommitdiff
path: root/libraries/base/Data
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2017-04-21 09:16:48 -0400
committerBen Gamari <ben@smart-cactus.org>2017-04-28 22:35:04 -0400
commit945c45ad50ed31e3acb96fdaafb21640c4669f12 (patch)
treeae2e59ba8d3a49bbd3c3dcece39d53aef691ed44 /libraries/base/Data
parente5b3492f23c2296d0d8221e1787ee585331f726e (diff)
downloadhaskell-945c45ad50ed31e3acb96fdaafb21640c4669f12.tar.gz
Prefer #if defined to #ifdef
Our new CPP linter enforces this.
Diffstat (limited to 'libraries/base/Data')
-rw-r--r--libraries/base/Data/Bits.hs2
-rw-r--r--libraries/base/Data/OldList.hs10
-rw-r--r--libraries/base/Data/Semigroup.hs4
3 files changed, 8 insertions, 8 deletions
diff --git a/libraries/base/Data/Bits.hs b/libraries/base/Data/Bits.hs
index 525f098524..d12d6dc4bd 100644
--- a/libraries/base/Data/Bits.hs
+++ b/libraries/base/Data/Bits.hs
@@ -57,7 +57,7 @@ module Data.Bits (
#include "MachDeps.h"
-#ifdef MIN_VERSION_integer_gmp
+#if defined(MIN_VERSION_integer_gmp)
# define HAVE_INTEGER_GMP1 MIN_VERSION_integer_gmp(1,0,0)
#endif
diff --git a/libraries/base/Data/OldList.hs b/libraries/base/Data/OldList.hs
index ec937e729b..bee1b6f98a 100644
--- a/libraries/base/Data/OldList.hs
+++ b/libraries/base/Data/OldList.hs
@@ -276,7 +276,7 @@ findIndex p = listToMaybe . findIndices p
-- | The 'findIndices' function extends 'findIndex', by returning the
-- indices of all elements satisfying the predicate, in ascending order.
findIndices :: (a -> Bool) -> [a] -> [Int]
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
findIndices p xs = [ i | (x,i) <- zip xs [0..], p x]
#else
-- Efficient definition, adapted from Data.Sequence
@@ -346,7 +346,7 @@ nub = nubBy (==)
-- user-supplied equality predicate instead of the overloaded '=='
-- function.
nubBy :: (a -> a -> Bool) -> [a] -> [a]
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
nubBy eq [] = []
nubBy eq (x:xs) = x : nubBy eq (filter (\ y -> not (eq x y)) xs)
#else
@@ -824,7 +824,7 @@ sort :: (Ord a) => [a] -> [a]
-- | The 'sortBy' function is the non-overloaded version of 'sort'.
sortBy :: (a -> a -> Ordering) -> [a] -> [a]
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
sort = sortBy compare
sortBy cmp = foldr (insertBy cmp) []
#else
@@ -1083,7 +1083,7 @@ lines s = cons (case break (== '\n') s of
-- | 'unlines' is an inverse operation to 'lines'.
-- It joins lines, after appending a terminating newline to each.
unlines :: [String] -> String
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
unlines = concatMap (++ "\n")
#else
-- HBC version (stolen)
@@ -1118,7 +1118,7 @@ wordsFB c n = go
-- | 'unwords' is an inverse operation to 'words'.
-- It joins words with separating spaces.
unwords :: [String] -> String
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
unwords [] = ""
unwords ws = foldr1 (\w s -> w ++ ' ':s) ws
#else
diff --git a/libraries/base/Data/Semigroup.hs b/libraries/base/Data/Semigroup.hs
index ec68683799..fae207ef97 100644
--- a/libraries/base/Data/Semigroup.hs
+++ b/libraries/base/Data/Semigroup.hs
@@ -85,7 +85,7 @@ import Data.Monoid (Alt (..))
import qualified Data.Monoid as Monoid
import Data.Ord (Down(..))
import Data.Void
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
import GHC.Event (Event, Lifetime)
#endif
import GHC.Generics
@@ -725,7 +725,7 @@ instance Semigroup (Proxy s) where
instance Semigroup a => Semigroup (IO a) where
(<>) = liftA2 (<>)
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
-- | @since 4.10.0.0
instance Semigroup Event where
(<>) = mappend