Dice Question Streamline Icon: https://streamlinehq.com

Feasibility of quasiquotation for relational pattern syntax in typedKanren

Determine how to properly employ Template Haskell quasiquotation for patterns in typedKanren’s relational matching so that the matching combinators matche and on remain regular Haskell functions rather than Template Haskell macros.

Information Square Streamline Icon: https://streamlinehq.com

Background

typedKanren implements typed relational matching using prisms because Haskell does not have built-in quasiquotation for patterns in regular functions. Quasiquotation in Haskell is available via Template Haskell, but integrating it with typedKanren’s matching while preserving ordinary (non-macro) function combinators poses design challenges.

The authors explicitly state that it is unclear how to use quasiquotation for patterns in this setting and defer investigating its feasibility, highlighting a concrete unresolved question about adopting quasiquotation without turning typedKanren’s core combinators into Template Haskell macros.

References

Quasiquotation is supported by Template Haskell, however, it is unclear how to properly use it for patterns here, since we want the main combinators to be regular Haskell functions, not Template Haskell functions (which would correspond to LISP macros). So, we leave research into feasibility of quasiquotation for future work.

typedKanren: Statically Typed Relational Programming with Exhaustive Matching in Haskell (2408.03170 - Kudasov et al., 6 Aug 2024) in Footnote, Section 3.1 (Prisms as First-Class Patterns in Haskell)