with one click
debug-unification
// Debug unification failures in deep6. Use when unification returns null or produces unexpected results.
// Debug unification failures in deep6. Use when unification returns null or produces unexpected results.
Use the deep6 library for deep equality, deep cloning, unification, and pattern matching with logical variables in a JavaScript/TypeScript project. Use when adding structural comparison, structured clone with circular references, extensible pattern matching with extraction, or unification-based logic to a project that depends on `deep6`.
Write or update tests for a module or feature. Use when asked to write tests, add test coverage, or verify functionality for deep6.
Add support for a new type to unify and clone registries. Use when asked to support a new JavaScript type or custom class in deep6.
Add a new unifier module to deep6. Use when asked to create custom pattern matching logic or extend unification behavior.
| name | debug-unification |
| description | Debug unification failures in deep6. Use when unification returns null or produces unexpected results. |
Debug why unification failed or produced unexpected variable bindings.
Identify the failing case
unify() or match()Understand the unification flow
src/unify.js main loop (lines 309-438)===)any/_)Unifier subclass)Add debug logging
src/unify.js at key decision points:
console.log('unify pair:', {l, r, typeL: typeof l, typeR: typeof r})Check variable bindings
env.getAllValues() after unificationTest in isolation
tests/tests.jsCommon failure modes
typeof l != typeof r (line 389)ignoreFunctions: trueFix and verify
npm test to verify all tests passmatch() with openObjects: false to require exact matchesopen(obj) or soft(obj) to control matching strictnessenv.depth to understand variable scopingnpm test — Run full test suitenpm run debug — Debug with Node inspectorenv.getAllValues() — Inspect variable bindings