Skip to content

036 graph transform#64

Merged
akollegger merged 8 commits intomainfrom
036-graph-transform
Feb 22, 2026
Merged

036 graph transform#64
akollegger merged 8 commits intomainfrom
036-graph-transform

Conversation

@akollegger
Copy link
Copy Markdown
Contributor

This pull request introduces a new bulk graph transformation module and improves the documentation and API surface of the pattern-hs library. The most important changes are the addition of the Pattern.Graph.Transform module for graph transformations, new exports and documentation in the main Pattern.hs module, and refactoring to avoid circular imports between graph modules. These updates make the library easier to use for graph transformation pipelines and clarify the separation between graph querying and transformation.

Graph transformation features:

  • Added the new Pattern.Graph.Transform module, including bulk graph transformation functions (unfoldGraph, mapGraph, mapAllGraph, filterGraph, foldGraph, mapWithContext, paraGraph, paraGraphFixed), and exported it in pattern.cabal and Pattern.hs. [1] [2]
  • Updated documentation and usage examples in Pattern.hs to highlight graph transformation pipelines and the new module. [1] [2]

API and documentation improvements:

  • Added GraphView and Substitution types to the exports and documentation of Pattern.Graph and Pattern.hs, clarifying their use in transformation pipelines. [1] [2]
  • Added a new unfold function (anamorphism) to Pattern.Core, enabling recursive construction of Pattern values from seed data. [1] [2]

Refactoring for modularity and circular import avoidance:

  • Moved the fromGraphLens constructor for GraphQuery from Pattern.Graph.GraphQuery to Pattern.Graph to avoid circular imports, and updated documentation and module exports accordingly. [1] [2] [3] [4]

Test coverage:

  • Added Spec.Pattern.Graph.TransformSpec to the test suite in pattern.cabal for the new transformation module.

Feature plan and rule updates:

  • Updated .cursor/rules/specify-rules.mdc to document the new graph transformation features and their Haskell implementation. [1] [2]

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new GraphView-based bulk graph transformation layer to pattern-hs, plus supporting API/doc updates and test coverage, aiming to enable composable transformation pipelines and context-aware/iterative algorithms over graphs.

Changes:

  • Introduces Pattern.Graph.Transform (bulk transforms + paraGraph/paraGraphFixed) and Pattern.Graph.Types (GraphView, Substitution).
  • Adds unfold (anamorphism) to Pattern.Core and expands top-level Pattern exports/docs for graph transformation workflows.
  • Refactors fromGraphLens into Pattern.Graph to avoid circular imports; wires new specs/tests and cabal exposure.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
libs/pattern/src/Pattern/Graph/Transform.hs New transformation/iteration API over GraphView.
libs/pattern/src/Pattern/Graph/Types.hs Defines GraphView + Substitution used by transform/filtering.
libs/pattern/src/Pattern/PatternGraph.hs Adds toGraphView + materialize for PatternGraphGraphView.
libs/pattern/src/Pattern/Graph.hs Adds fromGraphLens and toGraphView (from GraphLens) + docs/exports.
libs/pattern/src/Pattern/Graph/GraphQuery.hs Removes fromGraphLens export and updates docs to match refactor.
libs/pattern/src/Pattern/Core.hs Exposes new unfold function with Haddocks/examples.
libs/pattern/src/Pattern.hs Updates public API surface and documentation to include transform modules.
libs/pattern/tests/Spec/Pattern/Graph/TransformSpec.hs Adds test suite for new transform functionality.
libs/pattern/tests/Spec/Pattern/GraphSpec.hs Adds toGraphView integration tests for GraphLens.
libs/pattern/tests/Spec/Pattern/Graph/GraphQuerySpec.hs Updates imports for moved fromGraphLens.
libs/pattern/tests/Test.hs Registers new transform spec in test runner.
libs/pattern/pattern.cabal Exposes new modules + includes new test module.
specs/036-graph-transform/* Adds feature spec/plan/research/quickstart/contracts for the new feature.
.cursor/rules/specify-rules.mdc Notes the new feature in rule documentation.

…a in place and added a short comment that it is required; Removed the unused TypeFamilies pragma; test now selects the node whose enriched value is 2; Import now includes materialize
… to:

    -- Reconcile.HasIdentity v (Id v), Ord (Id v) in signatures so it’s clear why the extension is required.
@akollegger akollegger merged commit e6b1cba into main Feb 22, 2026
1 check passed
@akollegger akollegger deleted the 036-graph-transform branch February 22, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants