packages feed

ghc-heap-view 0.4.0.0 → 0.4.1.0

raw patch · 3 files changed

+12/−10 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- GHC.HeapView: ppPrintClosure :: (Int -> b -> String) -> Int -> GenClosure b -> String
+ GHC.HeapView: ppClosure :: (Int -> b -> String) -> Int -> GenClosure b -> String

Files

ghc-heap-view.cabal view
@@ -1,5 +1,5 @@ Name:                ghc-heap-view-Version:             0.4.0.0+Version:             0.4.1.0 Synopsis:            Extract the heap representation of Haskell values and thunks Description:   This library provides functions to introspect the Haskell heap, for example
ghci view
@@ -1,5 +1,3 @@-let _ghcHeapViewDepth = 1000 :: Int--:def setPrintHeapDepth \x -> return $ "let _ghcHeapViewDepth = " ++ x ++ ":: Int"+:def setPrintHeapDepth \x -> return $ ":def! printHeap \\x -> return $ \"GHC.HeapView.buildHeapGraph (" ++ x ++ ") (GHC.HeapView.asBox (\" ++ x ++ \")) >>= putStrLn . GHC.HeapView.ppHeapGraph\"" -:def printHeap \x -> return $ "GHC.HeapView.buildHeapGraph _ghcHeapViewDepth (GHC.HeapView.asBox (" ++ x ++ ")) >>= putStrLn . GHC.HeapView.ppHeapGraph"+:def printHeap \x -> return $ "GHC.HeapView.buildHeapGraph 1000 (GHC.HeapView.asBox (" ++ x ++ ")) >>= putStrLn . GHC.HeapView.ppHeapGraph"
src/GHC/HeapView.hs view
@@ -23,7 +23,7 @@     getBoxedClosureData,     getClosureRaw,     -- * Pretty printing-    ppPrintClosure,+    ppClosure,     -- * Heap maps     -- $heapmap     HeapTree(..),@@ -300,6 +300,10 @@         info         :: StgInfoTable          , indirectee   :: b     } |+    -- In GHCi, if Linker.h would allow a reverse looup, we could for exported+    -- functions fun actually find the name here.+    -- At least the other direction works via "lookupSymbol+    -- base_GHCziBase_zpzp_closure" and yields the same address (up to tags)     APClosure {         info         :: StgInfoTable          , arity      :: HalfWord@@ -622,8 +626,8 @@ -- using 'Data.Foldable.map' or, if you need to do IO, 'Data.Foldable.mapM'. -- -- The parameter gives the precedendence, to avoid avoidable parenthesises.-ppPrintClosure :: (Int -> b -> String) -> Int -> GenClosure b -> String-ppPrintClosure showBox prec c = case c of+ppClosure :: (Int -> b -> String) -> Int -> GenClosure b -> String+ppClosure showBox prec c = case c of     _ | Just ch <- isChar c -> app $         ["C#", show ch]     _ | Just (h,t) <- isCons c -> addBraces (5 <= prec) $@@ -710,7 +714,7 @@     go prec t@(HeapTree _ c')         | Just s <- isHeapTreeString t = show s         | Just l <- isHeapTreeList t   = "[" ++ intercalate "," (map ppHeapTree l) ++ "]"-        | otherwise                    =  ppPrintClosure go prec c'+        | otherwise                    =  ppClosure go prec c'  isHeapTreeList :: HeapTree -> Maybe ([HeapTree]) isHeapTreeList tree = do@@ -803,7 +807,7 @@     ppEntry prec e@(HeapGraphEntry _ c)         | Just s <- isString e = show s         | Just l <- isList e = "[" ++ intercalate "," (map (ppRef 0) l) ++ "]"-        | otherwise = ppPrintClosure ppRef prec c+        | otherwise = ppClosure ppRef prec c      ppRef _ Nothing = "..."     ppRef prec (Just i) | i `elem` bindings = "x" ++ show i