TP

Types from data Making structured data first-class citizens in F#

Tomas Petricek, Gustavo Guerra, Don Syme

In proceedings of PLDI 2016

Most modern applications interact with external services and access data in structured formats such as XML, JSON and CSV. Static type systems do not understand such formats, often making data access more cumbersome. Should we give up and leave the messy world of external data to dynamic typing and runtime checks? Of course, not!

We present F# Data, a library that integrates external structured data into F#. As most real-world data does not come with an explicit schema, we develop a shape inference algorithm that infers a shape from representative sample documents. We then integrate the inferred shape into the F# type system using type providers. We formalize the process and prove a relative type soundness theorem.

Our library significantly reduces the amount of data access code and it provides additional safety guarantees when contrasted with the widely used weakly typed techniques.

Paper and more information

Watch the talk

As far as I'm aware, the PLDI 2016 talk has not been recorded, but I did a brief practical demonstration of the F# Data library, similar to one that I did in a number of industry talks.

Bibtex

If you want to cite the paper, you can use the following BibTeX information, or get full details from the paper paper page on ACM

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
@inproceedings{petricek-2016-types,
  author    = {Tomas Petricek and Gustavo Guerra and Don Syme},
  title     = {Types from data: making structured data first-class citizens
               in F{\#}},
  booktitle = {Proceedings of the 37th {ACM} {SIGPLAN} Conference on
               Programming Language Design and Implementation, {PLDI} 2016,
               Santa Barbara, CA, USA, June 13-17, 2016},
  pages     = {477--490},
  publisher = {{ACM}},
  year      = {2016},
  doi       = {10.1145/2908080.2908115}
}

If you have any comments, suggestions or related ideas, I'll be happy to hear from you! Send me an email at tomas@tomasp.net or get in touch via BlueSky at @tomasp.net.

Published: Sunday, 1 May 2016, 12:00 am
Author: Tomas Petricek
Typos: Send me a pull request!