3 Synopsis: Extract the heap representation of Haskell values and thunks
5 This library provides functions to introspect the Haskell heap, for example
6 to investigate sharing and lazy evaluation.
8 It has been inspired by (and taken code from) the vacuum package and the GHCi
9 debugger, but also allows to investiage thunks and other closures.
11 This package also provides a new GHCi-command, @:printHeap@, which allows you
12 to inspect the current heap representation of a value, including sharing and
13 cyclic references. To enable the command, you need to load the included ghci
14 script or add it to @~/.ghci@, as explained by @cabal install@. Once it is
15 set up, you can do this:
17 >> let value = "A Value"
18 >> let x = (value, if head value == 'A' then value else "", cycle [True, False])
23 >> length (take 100 (show x)) `seq` return () -- evaluate everything
26 > x16 = True : False : x16
29 You can change the maximum recursion depth using @:setPrintHeapDepth@:
31 >> :setPrintHeapDepth 3
33 >let x1 = C# 'A' : ... : ...
34 >in (x1,x1,True : ... : ...)
36 If the view is impaired by blackholes (written @_bh@), running
37 @System.Mem.performGC@ usually helps.
39 The work on this package has been supported by the Deutsche Telekom Stiftung
40 (<http://telekom-stiftung.de>).
43 Author: Joachim Breitner, Dennis Felsing
44 Maintainer: Joachim Breitner <mail@joachim-breitner.de>
45 Copyright: 2012-2013 Joachim Breitner
49 Extra-source-files: Demo.hs
52 Flag prim-supports-any
53 Description: The used GHC supports Any as an argument to foreign prim functions (GHC ticket #5931)
57 Default-Language: Haskell2010
71 C-Sources: cbits/HeapView.c cbits/HeapViewPrim.cmm
75 if flag(prim-supports-any)
76 cpp-options: -DPRIM_SUPPORTS_ANY
78 source-repository head
80 location: http://darcs.nomeata.de/ghc-heap-view/