ghc-debug-common-0.3.0.0: Connect to a socket created by ghc-debug-stub and analyse the heap of the debuggee program.
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHC.Debug.Types.Graph

Synopsis

Types

data HeapGraph a Source #

The whole graph. The suggested interface is to only use lookupHeapGraph, as the internal representation may change. Nevertheless, we export it here: Sometimes the user knows better what he needs than we do.

Constructors

HeapGraph 

Instances

Instances details
Foldable HeapGraph Source # 
Instance details

Defined in GHC.Debug.Types.Graph

Methods

fold :: Monoid m => HeapGraph m -> m #

foldMap :: Monoid m => (a -> m) -> HeapGraph a -> m #

foldMap' :: Monoid m => (a -> m) -> HeapGraph a -> m #

foldr :: (a -> b -> b) -> b -> HeapGraph a -> b #

foldr' :: (a -> b -> b) -> b -> HeapGraph a -> b #

foldl :: (b -> a -> b) -> b -> HeapGraph a -> b #

foldl' :: (b -> a -> b) -> b -> HeapGraph a -> b #

foldr1 :: (a -> a -> a) -> HeapGraph a -> a #

foldl1 :: (a -> a -> a) -> HeapGraph a -> a #

toList :: HeapGraph a -> [a] #

null :: HeapGraph a -> Bool #

length :: HeapGraph a -> Int #

elem :: Eq a => a -> HeapGraph a -> Bool #

maximum :: Ord a => HeapGraph a -> a #

minimum :: Ord a => HeapGraph a -> a #

sum :: Num a => HeapGraph a -> a #

product :: Num a => HeapGraph a -> a #

Traversable HeapGraph Source # 
Instance details

Defined in GHC.Debug.Types.Graph

Methods

traverse :: Applicative f => (a -> f b) -> HeapGraph a -> f (HeapGraph b) #

sequenceA :: Applicative f => HeapGraph (f a) -> f (HeapGraph a) #

mapM :: Monad m => (a -> m b) -> HeapGraph a -> m (HeapGraph b) #

sequence :: Monad m => HeapGraph (m a) -> m (HeapGraph a) #

Functor HeapGraph Source # 
Instance details

Defined in GHC.Debug.Types.Graph

Methods

fmap :: (a -> b) -> HeapGraph a -> HeapGraph b #

(<$) :: a -> HeapGraph b -> HeapGraph a #

Show a => Show (HeapGraph a) Source # 
Instance details

Defined in GHC.Debug.Types.Graph

data HeapGraphEntry a Source #

For heap graphs, i.e. data structures that also represent sharing and cyclic structures, these are the entries. If the referenced value is Nothing, then we do not have that value in the map, most likely due to exceeding the recursion bound passed to buildHeapGraph.

Besides a pointer to the stored value and the closure representation we have a slot for arbitrary data, for the user's convenience.

Instances

Instances details
Foldable HeapGraphEntry Source # 
Instance details

Defined in GHC.Debug.Types.Graph

Methods

fold :: Monoid m => HeapGraphEntry m -> m #

foldMap :: Monoid m => (a -> m) -> HeapGraphEntry a -> m #

foldMap' :: Monoid m => (a -> m) -> HeapGraphEntry a -> m #

foldr :: (a -> b -> b) -> b -> HeapGraphEntry a -> b #

foldr' :: (a -> b -> b) -> b -> HeapGraphEntry a -> b #

foldl :: (b -> a -> b) -> b -> HeapGraphEntry a -> b #

foldl' :: (b -> a -> b) -> b -> HeapGraphEntry a -> b #

foldr1 :: (a -> a -> a) -> HeapGraphEntry a -> a #

foldl1 :: (a -> a -> a) -> HeapGraphEntry a -> a #

toList :: HeapGraphEntry a -> [a] #

null :: HeapGraphEntry a -> Bool #

length :: HeapGraphEntry a -> Int #

elem :: Eq a => a -> HeapGraphEntry a -> Bool #

maximum :: Ord a => HeapGraphEntry a -> a #

minimum :: Ord a => HeapGraphEntry a -> a #

sum :: Num a => HeapGraphEntry a -> a #

product :: Num a => HeapGraphEntry a -> a #

Traversable HeapGraphEntry Source # 
Instance details

Defined in GHC.Debug.Types.Graph

Methods

traverse :: Applicative f => (a -> f b) -> HeapGraphEntry a -> f (HeapGraphEntry b) #

sequenceA :: Applicative f => HeapGraphEntry (f a) -> f (HeapGraphEntry a) #

mapM :: Monad m => (a -> m b) -> HeapGraphEntry a -> m (HeapGraphEntry b) #

sequence :: Monad m => HeapGraphEntry (m a) -> m (HeapGraphEntry a) #

Functor HeapGraphEntry Source # 
Instance details

Defined in GHC.Debug.Types.Graph

Methods

fmap :: (a -> b) -> HeapGraphEntry a -> HeapGraphEntry b #

(<$) :: a -> HeapGraphEntry b -> HeapGraphEntry a #

Show a => Show (HeapGraphEntry a) Source # 
Instance details

Defined in GHC.Debug.Types.Graph

Building a heap graph

buildHeapGraph Source #

Arguments

:: MonadFix m 
=> DerefFunction m a 
-> Maybe Int 
-> ClosurePtr

The value to start with

-> m (HeapGraph a) 

Creates a HeapGraph for the value in the box, but not recursing further than the given limit.

multiBuildHeapGraph Source #

Arguments

:: MonadFix m 
=> DerefFunction m a 
-> Maybe Int 
-> NonEmpty ClosurePtr

Starting values with associated data entry

-> m (HeapGraph a) 

Creates a HeapGraph for the values in multiple boxes, but not recursing further than the given limit.

Printing a heap graph

ppHeapGraph :: (a -> String) -> HeapGraph a -> String Source #

Pretty-prints a HeapGraph. The resulting string contains newlines. Example for let s = "Ki" in (s, s, cycle "Ho"):

let x1 = "Ki"
    x6 = C# 'H' : C# 'o' : x6
in (x1,x1,x6)

ppClosure :: String -> (Int -> c -> String) -> Int -> DebugClosure p ConstrDesc s c -> String Source #

A pretty-printer that tries to generate valid Haskell for evalutated data. It assumes that for the included boxes, you already replaced them by Strings using map or, if you need to do IO, mapM.

The parameter gives the precedendence, to avoid avoidable parenthesises.

Utility

annotateHeapGraph :: (a -> a) -> HeapGraphIndex -> HeapGraph a -> HeapGraph a Source #

Adds the given annotation to the entry at the given index, using the mappend operation of its Monoid instance.

Reverse Graph