Semigroupoid Interfaces for Relation-Algebraic Programming in Haskell

  • Wolfram Kahl
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4136)


We present a Haskell interface for manipulating finite binary relations as data in a point-free relation-algebraic programming style that integrates naturally with the current Haskell collection types. This approach enables seamless integration of relation-algebraic formulations to provide elegant solutions of problems that, with different data organisation, are awkward to tackle.

Perhaps surprisingly, the mathematical foundations for dealing with finite relations in such a context are not well-established, so we provide an appropriate generalisation of relational categories to semigroupoids to serve as specification for our interface.

After having established an appropriate interface for relation-algebraic programming, we also need an efficient implementation; we find this in BDD-based kernel library KURE of recent versions of the Kiel RelView system. We show how this combination enables high-level declarative and efficient relational programming in Haskell.


Dependency Graph Transitive Closure Relation Algebra Relational Operation Type Safety 
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.
    Berghammer, R., Hoffmann, T., Leoniuk, B., Milanese, U.: Prototyping and Programming with Relations. ENTCS 44(3), 3.1–3.24 (2003)Google Scholar
  2. 2.
    Berghammer, R., Milanese, U.: Relational Approach to Boolean Logic Problems. In: MacCaull, W., Winter, M., Düntsch, I. (eds.) RelMiCS 2005. LNCS, vol. 3929, pp. 48–59. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  3. 3.
    Brink, C., Kahl, W., Schmidt, G. (eds.): Relational Methods in Computer Science. Advances in Computing Science. Springer, Wien, New York (1997)MATHGoogle Scholar
  4. 4.
    Bryant, R.E.: Graph-Based Algorithms for Boolean Function Manipulation. IEEE Transactions on Computers C-35(8), 677–691 (1986)CrossRefGoogle Scholar
  5. 5.
  6. 6.
    Desharnais, J., Möller, B., Struth, G.: Kleene Algebra with Domain. ACM Transactions on Computational Logic (2006)Google Scholar
  7. 7.
    Dougherty, D., Gutiérrez, C.: Normal Forms and Reduction for Theories of Binary Relations. In: Bachmair, L. (ed.) RTA 2000. LNCS, vol. 1833, pp. 95–109. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  8. 8.
    Freyd, P.J., Scedrov, A.: Categories, Allegories, North-Holland Mathematical Library, vol. 39. North-Holland, Amsterdam (1990)Google Scholar
  9. 9.
    Gansner, E.R., Koutsofios, E., North, S.C., Vo, K.-P.: A Technique for Drawing Directed Graphs. IEEE-TSE 19 214–230 (1993)Google Scholar
  10. 10.
    Haeberer, A., et al.: Fork Algebras. In: [3], Chapt. 4, pp. 54–69Google Scholar
  11. 11.
    Kahl, W., Schmidt, G.: Exploring (Finite) Relation Algebras Using Tools Written in Haskell. Technical Report 2000-02, Fakultät für Informatik, Universität der Bundeswehr München (2000),
  12. 12.
    Kahl, W.: A Relation-Algebraic Approach to Graph Structure Transformation, Habil. Thesis, Fakultät für Informatik, Univ. der Bundeswehr München, Techn. Bericht 2002-03 (2001)Google Scholar
  13. 13.
    Kahl, W.: Refactoring Heterogeneous Relation Algebras around Ordered Categories and Converse. J. Relational Methods in Comp. Sci. 1, 277–313 (2004)Google Scholar
  14. 14.
    Kahl, W.: HsDep: Dependency Graph Generator for Haskell Available at (2004),
  15. 15.
    Kozen, D.: A Completeness Theorem for Kleene Algebras and the Algebra of Regular Events. Inform. and Comput. 110(2), 366–390 (1991)CrossRefMathSciNetGoogle Scholar
  16. 16.
    Kozen, D.: Kleene Algebra with Tests. ACM Transactions on Programming Languages and Systems, 427–443 (1997)Google Scholar
  17. 17.
    Kozen, D.: Typed Kleene Algebra. Technical Report 98-1669, Computer Science Department, Cornell University (1998)Google Scholar
  18. 18.
    Leoniuk, B.: ROBDD-basierte Implementierung von Relationen und relationalen Operationen mit Anwendungen. PhD thesis, Institut für Informatik und Praktische Mathematik, Christian-Albrechts-Universität Kiel (2001)Google Scholar
  19. 19.
    Mac Lane, S.: Categories for the Working Mathematician. Springer, Heidelberg (1971)MATHGoogle Scholar
  20. 20.
    Milanese, U.: KURE: Kiel University Relation Package, Release 1.0. (2004),
  21. 21.
    Möller, B.: Typed Kleene algebras. Technical Report 1999-8, Institut für Informatik, Universität Augsburg (1999)Google Scholar
  22. 22.
    Nilsson, M.: GBDD — A package for representing relations with BDDs (2004), Available from
  23. 23.
    Peyton Jones, S., et al.: The Revised Haskell 98 Report. Cambridge University Press, Cambridge (2003), Also on Google Scholar
  24. 24.
    Schmidt, G., Hattensperger, C., Winter, M.: Heterogeneous Relation Algebra. In [3], Chapt. 3, pp. 39–53Google Scholar
  25. 25.
    Schröder, L.: Isomorphisms and splitting of idempotents in semicategories. Cahiers de Topologie et Géométrie Différentielle catégoriques 41, 143–153 (2000)MATHGoogle Scholar
  26. 26.
    Tilson, B.: Categories as algebra: an essential ingredient in the theory of monoids. Journal of Pure and Applied Algebra 48, 83–198 (1987)CrossRefMathSciNetMATHGoogle Scholar
  27. 27.
    Weil, P.: Profinite methods in semigroup theory. Intl. J. Algebra Comput. 12, 137–178 (2002)CrossRefMathSciNetMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Wolfram Kahl
    • 1
  1. 1.McMaster UniversityHamiltonCanada

Personalised recommendations