ghc-vis-0.7.1: Live visualization of data structures in GHCi

Maintainerdennis@felsin9.de
Safe HaskellNone

GHC.Vis

Description

Although ghc-vis is meant to be used in GHCi it can also be used as a library in regular Haskell programs which are run or compiled by GHC. You can run those programs using "runghc example.hs" or "ghc -threaded example.hs && ./example". Without the "-threaded"-Flag ghc-vis does not work correctly. This is an example using ghc-vis outside of GHCi:

 import GHC.Vis

 main = do
   putStrLn "Start"
   let a = "teeest"
   let b = [1..3]
   let c = b ++ b
   let d = [1..]
   putStrLn $ show $ d !! 1

   visualization
   view a "a"
   view b "b"
   view c "c"
   view d "d"

   getChar
   switch

   getChar
   putStrLn "End"

Synopsis

Documentation

vis :: IO ()Source

This is the main function. It's to be called from GHCi and launches a graphical window in a new thread.

mvis :: IO ()Source

A minimalistic version of ghc-vis, without window decorations, help and all that other stuff.

view :: a -> String -> IO ()Source

Add expressions with a name to the visualization window.

eval :: String -> IO ()Source

Evaluate an object that is shown in the visualization. (Names start with t)

switch :: IO ()Source

Switch between the list view and the graph view

update :: IO ()Source

When an object is updated by accessing it, you have to call this to refresh the visualization window. You can also click on an object to force an update.

clear :: IO ()Source

Clear the visualization window, removing all expressions from it

restore :: IO ()Source

Reset the hidden boxes

history :: (Int -> Int) -> IO ()Source

Change position in history

setDepth :: Int -> IO ()Source

Set the maximum depth for following closures on the heap

export :: String -> IO ()Source

Export the current visualization view to a file, format depends on the file ending. Currently supported: svg, png, pdf, ps