We introduce a novel implementation of subtyping among regular expression types in terms of Haskell-style type classes by making use of some modest type class extensions. We assume that each regular expression type has some underlying structured runtime representation. Hence, we not only check for the containment problem among regular expressions, but also automatically derive some appropriate casting functions among the underlying structured values. We believe that this work is the first step in adding type-safe XML support to languages such as Haskell.
Lu, K. Z. M., & Sulzmann, M. (2004). An implementation of subtyping among regular expression types. Lecture Notes in Computer Science (Including Subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics), 3302, 57–73. https://doi.org/10.1007/978-3-540-30477-7_5