# reify: Serialize data

[ data, library, program ] [ Propose Tags ]

This is a library for reifying Haskell data structures in GHC. Haskell values are mapped into representations that we call graphs (for want of a better name). The representations are encoded in the Haskell type Graph, which is just an ordinary algebraic data type. This will not reify functions.

Bitrotten.

Versions [faq] 0.1, 0.1.1 base, ghc (==6.5) [details] LicenseRef-GPL Bernie Pope none Data http://www.cs.mu.oz.au/~bjpop/code.html by GwernBranwen at Mon Jan 19 22:40:00 UTC 2009 NixOS:0.1.1 reify 1228 total (18 in the last 30 days) (no votes yet) [estimated by rule of succession] λ λ λ Docs not available All reported builds failed as of 2017-01-02

## Modules

• PrettyGraph
• ReifyHs

#### Maintainer's Corner

For package maintainers and hackage trustees

[back to package description]
This is a library for reifying Haskell data structures in GHC.

Haskell values are mapped into representations that we call
graphs (for want of a better name). The representations are
encoded in the Haskell type Graph, which is just an ordinary
algebraic data type.

The method for reification is:

reify :: a -> IO Graph

Note that it can take _any_ value as its argument, there are
no constraints on that type.

The result is returned in the IO monad because the Graph
that it returns depends on the state of evaluation of the
underlying value. To do otherwise would not be pure.

The reification is conservative (or lazy). It will not cause any
further evaluation of the value being observed. So you can safely
apply reify to lazy data structures etc.

reify also detects cycles in the heap representation of a value.
The cycles are visible in the resulting Graph. If a value has
a finite heap representation, then reify will return a finite
Graph! Each node in the Graph structure is tagged with a unique
label that can be used to identify nodes and re-construct cycles.

reify does not observe other forms of sharing within a value
(sharing that does not lead to cycles).

A method for pretty printing Graphs is provided by the module
PrettyGraph.

Sadly, all functions are represented by the same Graph, and
are pretty printed just as "<Function>".

reify also knows a little bit about exceptions and other slightly
weird things inside GHC, but it is not yet exhaustive (GHC has many
heap object types).

Unfortunately, we need to turn on profiling in order to get GHC to
keep the names of data constructors around on the heap. This is
an ugly hack, and I hope that one day it can be avoided (perhaps
with some help from the compiler team).

If you make any modifications please contribute them back to me.
Thanks.

Bernie: bjpop@cs.mu.oz.au