Simulating quantified class constraints

  • Authors:
  • Valery Trifonov

  • Affiliations:
  • Yale University, New Haven, CT

  • Venue:
  • Haskell '03 Proceedings of the 2003 ACM SIGPLAN workshop on Haskell
  • Year:
  • 2003

Quantified Score

Hi-index 0.00

Visualization

Abstract

Defining nontrivial class instances for irregular and exponential datatypes in Haskell is challenging, and as a solution it has been proposed to extend the language with quantified class constraints of the form ∀a. C a ⇒ C' (f a) in the contexts of instance declarations. We show how to express the equivalent of such constraints in vanilla Haskell 98, but their utility in this language is limited. We also present a more flexible solution, which relies on a widely-supported language extension.