summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Tennie <sven.tennie@gmail.com>2022-02-20 13:28:48 +0100
committerSven Tennie <sven.tennie@gmail.com>2022-02-27 17:03:15 +0000
commit6fb7791393ef3e2a6b5a49f4ed1d8d8fb31514a0 (patch)
tree72eb481db30472dbf2f3f213683810d285ff9dc5
parent0a80b43641c0b66ecdc6cf1d3ae08b002a0f270f (diff)
downloadhaskell-6fb7791393ef3e2a6b5a49f4ed1d8d8fb31514a0.tar.gz
Fix some hlint issues in ghc-heapwip/hlint_ghc-heap
This does not fix all hlint issues as the criticised index and length expressions seem to be fine in context.
-rw-r--r--libraries/ghc-heap/GHC/Exts/Heap.hs9
-rw-r--r--libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/Types.hs2
2 files changed, 4 insertions, 7 deletions
diff --git a/libraries/ghc-heap/GHC/Exts/Heap.hs b/libraries/ghc-heap/GHC/Exts/Heap.hs
index 2906cf6926..a587739813 100644
--- a/libraries/ghc-heap/GHC/Exts/Heap.hs
+++ b/libraries/ghc-heap/GHC/Exts/Heap.hs
@@ -1,13 +1,10 @@
{-# LANGUAGE CPP #-}
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeFamilies #-}
-{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE UnliftedFFITypes #-}
@@ -157,7 +154,7 @@ getClosureDataFromHeapObject x = do
let infoTablePtr = Ptr infoTableAddr
ptrList = [case indexArray# pointersArray i of
(# ptr #) -> Box ptr
- | I# i <- [0..(I# (sizeofArray# pointersArray)) - 1]
+ | I# i <- [0..I# (sizeofArray# pointersArray) - 1]
]
infoTable <- peekItbl infoTablePtr
@@ -204,7 +201,7 @@ getClosureDataFromHeapRepPrim getConDesc decodeCCS itbl heapRep pts = do
rawHeapWords :: [Word]
rawHeapWords = [W# (indexWordArray# heapRep i) | I# i <- [0.. end] ]
where
- nelems = (I# (sizeofByteArray# heapRep)) `div` wORD_SIZE
+ nelems = I# (sizeofByteArray# heapRep) `div` wORD_SIZE
end = fromIntegral nelems - 1
-- Just the payload of rawHeapWords (no header).
@@ -236,7 +233,7 @@ getClosureDataFromHeapRepPrim getConDesc decodeCCS itbl heapRep pts = do
fail "Expected at least 1 ptr argument to AP"
-- We expect at least the arity, n_args, and fun fields
unless (length payloadWords >= 2) $
- fail $ "Expected at least 2 raw words to AP"
+ fail "Expected at least 2 raw words to AP"
let splitWord = payloadWords !! 0
pure $ APClosure itbl
#if defined(WORDS_BIGENDIAN)
diff --git a/libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/Types.hs b/libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/Types.hs
index 5ff030d923..ced6c5ef46 100644
--- a/libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/Types.hs
+++ b/libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/Types.hs
@@ -9,7 +9,7 @@ import GHC.Generics
-- | This is a somewhat faithful representation of StgTSOProfInfo. See
-- <https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/storage/TSO.h>
-- for more details on this data structure.
-data StgTSOProfInfo = StgTSOProfInfo {
+newtype StgTSOProfInfo = StgTSOProfInfo {
cccs :: Maybe CostCentreStack
} deriving (Show, Generic, Eq, Ord)