SkillAgentSearch skills...

Spyshare

a tiny tool for visualising substructual sharing in data structures 🕵️‍♀️

Install / Use

/learn @disconcision/Spyshare
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

🔍 SPYSHARE 🔍

A tiny tool for visualising sharing between Haskell data structures.

Example: In the screenshot below, a persistent base list (list0) shares data with its tail (list1) and a new list which prepends to the base list (list2). Note that append (++) shares (list3) but concat does not (list4).)

An example sharing graph and code

🔍 Graphvis and StableNames expose shared structure

Spyshare generates a graph-based visualization of composite data structures in Haskell. It uses StableName (and hence unsafePerformIO) to track actual memory locations, and can thus be used to visualize substructural sharing, as in the above screenshot. Out of the box, spyshare works only on lists, but it is rudimentarily abstractble (via its MemMappable typeclass) to permit easy extension to some ADTs, like the binary trees below:

an example with a custom binary tree ADT

I made this as a personal utility when I was doing research on variational data structures with Ramy Shahin. It's barebones, but could likely be straightforwardly extended into a useful didactic tool

🔍 Installation and Usage Instructions

  • Install Graphvis and clone this repository
  • Import SpyShare and call showGraph on a list of pairs where the first elements are labels (Strings) and the second elements are identifiers indicating the data to be visualized
  • A png-format image will be created in the working directory. In linux, the image will open automatically, provided there's an application installed which can handle PNGs
  • Untamed unsafeness warning: keep programs simple to avoid confusing results
View on GitHub
GitHub Stars18
CategoryDevelopment
Updated2mo ago
Forks1

Languages

Haskell

Security Score

75/100

Audited on Jan 19, 2026

No findings