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

Maintainerdennis@felsin9.de
Safe HaskellSafe-Infered

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

visualization :: IO ()Source

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

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.

export :: String -> IO ()Source

Export the current visualization view to an SVG file.