Skip to main content

Module comonad_helpers

Module comonad_helpers 

Source
Expand description

Helper functions demonstrating practical applications of Comonad operations.

This module provides position-aware helper functions that compute structural metadata at every position in a pattern:

  • depth_at(): Decorate each position with its depth (maximum nesting level)
  • size_at(): Decorate each position with its subtree size (total node count)
  • indices_at(): Decorate each position with its path from root (sequence of indices)

These helpers demonstrate how extend enables natural expression of context-aware computation, where functions have access to the full subpattern at each position.