MyNixOS website logo
Description

Extract the heap representation of Haskell values and thunks.

This library provides functions to introspect the Haskell heap, for example to investigate sharing and lazy evaluation. As this is tied to the internals of the compiler, it only works with specific versions. This version supports, GHC 8.8. For GHC 8.6 use version 0.6.0. For older GHC versions see ghc-heap-view-0.5.10.

It has been inspired by (and taken code from) the vacuum package and the GHCi debugger, but also allows to investigate thunks and other closures.

This package also provides a new GHCi-command, :printHeap, which allows you to inspect the current heap representation of a value, including sharing and cyclic references. To enable the command, you need to load the included ghci script or add it to ~/.ghci, as explained by cabal install. Once it is set up, you can do this:

> let value = "A Value"
> let x = (value, if head value == 'A' then value else "", cycle [True, False])
> :printHeap x
let x1 = _bco
    x21 = []
in (x1,_bco,_bco)
> length (take 100 (show x)) `seq` return () -- evaluate everything
> :printHeap x
let x1 = "A Value"
    x16 = True : False : x16
in (x1,x1,x16)

You can change the maximum recursion depth using :setPrintHeapDepth:

> :setPrintHeapDepth 3
> :printHeap x
let x1 = C# 'A' : ... : ...
in (x1,x1,True : ... : ...)

If the view is impaired by blackholes (written _bh), running System.Mem.performGC usually helps.

The work on this package has been supported by the Deutsche Telekom Stiftung (http://telekom-stiftung.de).

Metadata

Version

0.6.4.1

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows