article

Experience report: types for a relational algebra library

Abstract

As part of our software toolkit at a major financial institution we have a library for relational algebra. This library is written in C++ and the type checking of the operations on the relations is very dynamic; all relations have the same static type. Of course, relational algebra operations have stringent type constraints, and since we believe in static typing, we would prefer these to be checked at compile time.

We have managed to get full static type checking of the relational code, using some modern extensions to the Haskell type system, such as closed type families, type level strings, user-defined kinds, and custom type errors. The static type checking incurs no runtime overhead compared to the dynamically checked library.

Some effort has gone into making the use of the typed library similar to the dynamically typed version. We have also tried to produce good error messages when something is wrong.

References

  1. Jan Van den Bussche and Stijn Vansummeren. Polymorphic type inference for the named nested relational calculus. ACM Trans. Comput. Logic, 9 (1), December 2007. ISSN 1529-3785. doi: 10.1145/1297658.1297661. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. C.J. Date. An Introduction to Database Systems. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 8 edition, 2003. ISBN 0321197844. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Julian Fleischer. Named records. http://hackage.haskell.org/ package/named-records, 2013.Google ScholarGoogle Scholar
  4. Oleg Kiselyov, Ralf Lämmel, and Keean Schupke. Strongly typed heterogeneous collections. In Proceedings of the 2004 ACM SIGPLAN Workshop on Haskell, Haskell ’04, pages 96–107, New York, NY, USA, 2004. ACM. ISBN 1-58113-850-4. doi: 10.1145/1017472.1017488. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Nikita Volkov. Record. http://hackage.haskell.org/ package/record, 2015.Google ScholarGoogle Scholar

Comments

Login options

Check if you have access through your login credentials or your institution to get full access on this article.

Sign in

Full Access

PDF Format

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader
About Cookies On This Site

We use cookies to ensure that we give you the best experience on our website.

Learn more

Got it!