An Implementation of Subtyping Among Regular Expression Types

  • Kenny Zhuo Ming Lu
  • Martin Sulzmann
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3302)


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.


Regular Expression Type Class Proof System Type Check Proof Rule 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Aiken, A., Murphy, B.: Implementing regular tree expressions. In: Hughes, J. (ed.) FPCA 1991. LNCS, vol. 523, pp. 427–447. Springer, Heidelberg (1991)CrossRefGoogle Scholar
  2. 2.
    Antimirov, V.M.: Rewriting regular inequalities. In: Reichel, H. (ed.) FCT 1995. LNCS, vol. 965, pp. 116–125. Springer, Heidelberg (1995)CrossRefGoogle Scholar
  3. 3.
    Benzaken, V., Castagna, G., Frisch, A.: Cduce: An XML-centric general-purpose language. In: Proc. of ICFP 2003, pp. 51–63. ACM Press, New York (2003)Google Scholar
  4. 4.
    Crary, K.: Foundations for the implementation of higher-order subtyping. In: Proc. of ICFP 1997, pp. 125–135. ACM Press, New York (1997)Google Scholar
  5. 5.
    Duck, G.J., Peyton-Jones, S., Stuckey, P.J., Sulzmann, M.: Sound and decidable type inference for functional dependencies. In: Schmidt, D. (ed.) ESOP 2004. LNCS, vol. 2986, pp. 49–63. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  6. 6.
    Frisch, A., Cardelli, L.: Greedy regular expression matching. In: PLAN-X 2004 Informal Proceedings (2004)Google Scholar
  7. 7.
    Glasgow Haskell compiler home page,
  8. 8.
    Hall, C.V., Hammond, K., Peyton Jones, S., Wadler, P.: Type classes in Haskell. In: Sannella, D. (ed.) ESOP 1994. LNCS, vol. 788, pp. 241–256. Springer, Heidelberg (1994)CrossRefGoogle Scholar
  9. 9.
    Hosoya, H.: Regular Expression Types for XML. PhD thesis, The University of Tokyo (December 2000)Google Scholar
  10. 10.
    Hosoya, H., Pierce, B.C.: Regular expression pattern matching for XML. In: Proc. of POPL 2001, pp. 67–80. ACM Press, New York (2001)Google Scholar
  11. 11.
    Hosoya, H., Vouillon, J., Pierce, B.C.: Regular expression types for XML. ACM SIGPLAN Notices 35(9), 11–22 (2000)CrossRefzbMATHGoogle Scholar
  12. 12.
    Jones, M.P.: Type classes with functional dependencies. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, p. 230. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  13. 13.
    Kempa, M., Linnemann, V.: Type checking in XOBE. In: Proc. Datenbanksysteme fur Business, Technologie und Web, BTW 2003, LNI, pp. 227–246, GI (2003)Google Scholar
  14. 14.
    Lu, K.Z.M., Sulzmann, M.: XHaskell (2004),
  15. 15.
    Lu, K.Z.M., Sulzmann, M.: An implementation of subtyping among regular expression types. Technical report, The National University of Singapore (2004),
  16. 16.
    Neubauer, M., Thiemann, P., Gasbichler, M., Sperber, M.: Functional logic overloading. In: Proc. of POPL 2002, pp. 233–244. ACM Press, New York (2002)Google Scholar
  17. 17.
    Peyton Jones, S., et al.: Report on the programming language Haskell 98 (February 1999),
  18. 18.
    Stuckey, P.J., Sulzmann, M.: A theory of overloading. In: Proc. of ICFP 2002, pp. 167–178. ACM Press, New York (2002)Google Scholar
  19. 19.
    Stuckey, P.J., Sulzmann, M., Wazny, J.: Interactive type debugging in Haskell. In: Proc. of Haskell Workshop 2003, pp. 72–83. ACM Press, New York (2003)Google Scholar
  20. 20.
    Sulzmann, M., Wazny, J.: The Chameleon system (July 2004),
  21. 21.
    Thiemann, P.: A typed representation for HTML and XML documents in Haskell. Journal of Functional Programming 12(4,5), 435–468 (2002)MathSciNetzbMATHGoogle Scholar
  22. 22.
    Wallace, M., Runciman, C.: Haskell and XML: Generic combinators or type-based translation? In: ICFP 1999, pp. 148–159. ACM Press, New York (1999)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Kenny Zhuo Ming Lu
    • 1
  • Martin Sulzmann
    • 1
  1. 1.School of ComputingNational University of SingaporeSingapore

Personalised recommendations