Skip to content

Conversation

@akollegger
Copy link
Contributor

This pull request implements the migration to updated Pattern constructor names as part of the Gram-HS library integration. The primary focus is on replacing the old pattern and pattern-with/patternWith constructors with the new pure, pattern, and (in Haskell) point functions in all documentation, specs, and example code. No changes are made to the underlying data model or external API—this is a refactoring for internal consistency and future compatibility. Additionally, new documentation and checklists are added for the migration.

Pattern Constructor Migration

  • Replaced all uses of pattern for atomic patterns with pure (in Lisp/Plisp examples/specs) and with point (in Haskell internal API), and replaced all uses of pattern-with/patternWith with pattern for patterns with elements. This affects example files, documentation, and quickstart guides. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18]

Documentation and Specification Updates

  • Updated .cursor/rules/specify-rules.mdc to document the new constructor usage and migration plan for Gram-HS, including migration rationale and test coverage. [1] [2]
  • Added migration-specific documentation: data model, contracts, and a requirements checklist for the Gram-HS constructor migration, clarifying that the change is internal and does not affect the public API or serialization format. [1] [2] [3]

These changes ensure all internal and example code is consistent with the new Gram-HS constructor API, paving the way for future development and maintenance.

Copy link
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

This pull request implements a comprehensive migration to the updated Gram-HS library constructor API, systematically replacing the old pattern/patternWith constructor names with the new pure/pattern (in Lisp) and point/pattern (in Haskell) functions throughout the codebase. The migration maintains functional equivalence while ensuring consistency with the updated library's naming conventions.

Key Changes:

  • Updated Pattern constructor imports from Pattern.Core (pattern, patternWith) to Pattern.Core (point, pattern) across all affected modules
  • Replaced atomic pattern constructions (pattern value) with point value in Haskell code and pure value in Lisp examples
  • Replaced pattern-with-elements constructions (patternWith decoration elements) with pattern decoration elements throughout the codebase
  • Added comprehensive migration documentation including specifications, quickstart guides, and task checklists

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/PatternLisp/RuntimeSpec.hs Updated imports and replaced pattern with point for atomic patterns; updated test comments
test/PatternLisp/PrimitivesSpec.hs Updated test descriptions and examples from pattern/pattern-with to pure/pattern
test/PatternLisp/PatternSpec.hs Updated all test cases to use pure for atomic patterns and pattern for patterns with elements
test/PatternLisp/GramSpec.hs Updated imports and replaced constructors in test helper functions
test/PatternLisp/GramSerializationSpec.hs Updated imports and constructor usage in serialization tests
test/PatternLisp/CodecSpec.hs Updated imports and helper functions to use new constructor names
src/PatternLisp/Syntax.hs Renamed PatternWith primitive to Pure; updated primitive documentation and name mappings
src/PatternLisp/Primitives.hs Updated initial environment to register pure instead of pattern-with; updated comments
src/PatternLisp/PatternPrimitives.hs Replaced all patternWith calls with pattern and pattern calls with point; updated module documentation
src/PatternLisp/Gram.hs Updated import and replaced atomic pattern with point
src/PatternLisp/Eval.hs Updated primitive application handlers for Pure and PatternCreate with corrected error messages
src/PatternLisp/Codec.hs Extensive updates replacing ~40 occurrences of patternWith with pattern and atomic pattern with point
specs/006-gram-hs-migration/tasks.md Added comprehensive task breakdown for migration with 38 tasks across 6 phases
specs/006-gram-hs-migration/spec.md Added feature specification with user stories, requirements, and success criteria
specs/006-gram-hs-migration/research.md Added migration guide analysis and codebase analysis documentation
specs/006-gram-hs-migration/quickstart.md Added quickstart guide with migration steps and common patterns
specs/006-gram-hs-migration/plan.md Added implementation plan with constitution checks and project structure
specs/006-gram-hs-migration/data-model.md Added data model documentation clarifying no structural changes
specs/006-gram-hs-migration/contracts/README.md Added contracts documentation for internal API changes
specs/006-gram-hs-migration/checklists/requirements.md Added specification quality checklist
specs/003-pattern-state-functions/quickstart.md Updated examples to use pure and pattern instead of old constructors
examples/pattern-predicates.plisp Updated example code to use pure for atomic patterns
examples/pattern-basics.plisp Updated example code to use pure and pattern
docs/plisp-serialization-design.md Updated documentation examples and primitive lists
docs/pattern-state-lisp-design.md Updated all code examples to use new constructor names
.github/workflows/build-and-test.yml Added cache restore-key and cabal v2-update command
.cursor/rules/specify-rules.mdc Added migration to recent changes list

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

~/.cabal/packages
key: ${{ runner.os }}-cabal-${{ matrix.ghc-version }}-${{ hashFiles('cabal.project', 'pattern-lisp.cabal') }}
restore-keys: |
${{ runner.os }}-cabal-${{ matrix.ghc-version }}-${{ hashFiles('cabal.project', 'pattern-lisp.cabal') }}-
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

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

The duplicate cache restore-key pattern may cause cache restoration issues. The key ${{ runner.os }}-cabal-${{ matrix.ghc-version }}-${{ hashFiles('cabal.project', 'pattern-lisp.cabal') }}- with a trailing dash appears twice in the restore-keys list (lines 40 and 41). This duplication is redundant and should be removed to avoid confusion and potential cache lookup inefficiencies.

Copilot uses AI. Check for mistakes.
cabal update
# Force update of source-repository-packages to get latest gram-hs
# This ensures we get the latest version with 'point' export
cabal v2-update
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

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

The command cabal v2-update is redundant and unnecessary. The cabal update command on the previous line already updates the package index, including source-repository-packages. The v2-update command is deprecated in modern Cabal versions (the v2- prefix is no longer needed), and calling both update commands sequentially provides no additional benefit while adding unnecessary build time.

Suggested change
cabal v2-update

Copilot uses AI. Check for mistakes.
@akollegger
Copy link
Contributor Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Dec 31, 2025

@akollegger I've opened a new pull request, #8, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits December 31, 2025 09:22
Clean up CI/CD workflow cache configuration and remove deprecated commands
@akollegger akollegger merged commit 58de2e1 into main Dec 31, 2025
1 check passed
@akollegger akollegger deleted the 006-gram-hs-migration branch December 31, 2025 12:55
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