[Haskell-cafe] ghc-heap-view now with recursive pretty-printing

Thomas Schilling nominolo at googlemail.com
Tue Dec 25 16:58:16 CET 2012


On 21 December 2012 11:16, Joachim Breitner <mail at joachim-breitner.de> wrote:
> Prelude> :script /home/jojo/.cabal/share/ghc-heap-view-0.4.0.0/ghci
> Prelude> let x = [1..10]
> Prelude> x
> [1,2,3,4,5,6,7,8,9,10]
> Prelude> :printHeap x
> _bh [S# 1,S# 2,S# 3,S# 4,S# 5,S# 6,S# 7,S# 8,S# 9,S# 10]
>
> Note that the tools shows us that the list is a list of S# constructors,
> and also that it is still hidden behind a blackhole. After running
> System.Mem.performGC, this would disappear.

Why do you call it a "blackhole"?  I assume you mean a thunk that has
been evaluated and updated with its value.  The commonly used term for
this is "indirection".  A blackhole is used to detect when a thunk's
value depends on itself (e.g., in "let x = id x in ..." the thunk for
x may get turned into a black hole).

It's a minor thing, but I think it's a good idea to stick to existing
terminology. Otherwise, it looks like a useful tool. Eventually, we
probably want an interactive graph where we can click a node to
evaluate it (or to show/hide children nodes).

--
Push the envelope. Watch it bend.



More information about the Haskell-Cafe mailing list