Hylograph Project Documentation

hylograph-selection

purescript-hylograph-selection

This is the core package of Hylograph, a PureScript library system for building interactive data visualizations. Hylograph provides declarative tree construction, force simulation, graph data structures, layout algorithms, and more — all in pure PureScript with zero JavaScript visualization dependencies. See hylograph.net for documentation, guides, and examples.

Declarative DOM tree construction and interpretation for PureScript. Zero runtime dependencies on D3 or any other JavaScript visualization library.

Interactive Demo: The Hylographic Fold — a seven-chapter guide explaining how HATS works, built entirely with HATS.

Installation

spago install hylograph-selection

Overview

Build visualizations as declarative trees using HATS (Hylomorphic Abstract Tree Syntax). A HATS tree describes what to build; interpreters decide how.

import Hylograph.HATS (elem, forEach, staticStr)
import Hylograph.HATS.Friendly as F
import Hylograph.HATS.InterpreterTick (rerender)
import Hylograph.Internal.Element.Types (ElementType(..))

barChart :: Array { label :: String, value :: Number } -> Tree
barChart data =
  elem SVG [ F.viewBox 0.0 0.0 400.0 300.0 ]
    [ forEach "bars" Group data _.label \d ->
        elem Rect
          [ F.x (d.idx * 50.0)
          , F.y (300.0 - d.value)
          , F.width 40.0
          , F.height d.value
          , F.fill "#C9A962"
          ] []
    ]

The same tree can be interpreted as SVG (rendered to the DOM), English (plain text description), Mermaid (diagram syntax), or MetaHATS (a visualization of the tree’s own structure).

Key Features

Modules

Core

Scales (pure, no D3)

Interpreters

Interactions

The Hylograph Library System

This package is the foundation. The full ecosystem:

Package Description
hylograph-selection Core: HATS tree construction, interpreters (SVG, English, Mermaid, MetaHATS), scales, color schemes, coordinated highlighting, zoom, brush, pointer events. This package.
hylograph-graph Graph data structures — adjacency lists, traversals, connected components, topological sort.
hylograph-layout Layout algorithms — tree layouts, edge bundling, Sankey diagrams, treemaps, beeswarm, force-directed placement.
hylograph-simulation Force simulation — n-body, collision, link forces, centering. Halogen integration for animated simulations.
hylograph-simulation-halogen Halogen component wrapper for force simulations with tick-driven rendering.
hylograph-canvas Canvas rendering backend for high-performance visualizations.
hylograph-optics Optics (lenses, prisms) for traversing and transforming HATS trees.
hylograph-music Proof of concept: interpret data to sound just as readily as data to visuals. Same fold, different output.

All packages are published to the PureScript Registry and documented at hylograph.net.

License

MIT