Complex protocols describing the communication or storage of binary data are difficult to describe precisely. This paper presents a collection of data types for describing a binary data formats; the corresponding parser and pretty printer are generated automatically from a data description. By embedding these data types in a general purpose dependently typed programming language, we can verify once and for all that the parsers and pretty printers generated in this style are correct by construction. To validate our results, we show how to write a verified parser of the IPv4 network protocol.
{"title":"Generic packet descriptions: verified parsing and pretty printing of low-level data","authors":"M. V. Geest, Wouter Swierstra","doi":"10.1145/3122975.3122979","DOIUrl":"https://doi.org/10.1145/3122975.3122979","url":null,"abstract":"Complex protocols describing the communication or storage of binary data are difficult to describe precisely. This paper presents a collection of data types for describing a binary data formats; the corresponding parser and pretty printer are generated automatically from a data description. By embedding these data types in a general purpose dependently typed programming language, we can verify once and for all that the parsers and pretty printers generated in this style are correct by construction. To validate our results, we show how to write a verified parser of the IPv4 network protocol.","PeriodicalId":166018,"journal":{"name":"Proceedings of the 2nd ACM SIGPLAN International Workshop on Type-Driven Development","volume":"12 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-09-03","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"116151206","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Victor Cacciari Miraldo, Pierre-Évariste Dagand, Wouter Swierstra
The Unix diff utility that compares lines of text is used pervasively by version control systems. Yet certain changes to a program may be difficult to describe accurately in terms of modifications to individual lines of code. As a result, observing changes at such a fixed granularity may lead to unnecessary conflicts between different edits. This paper presents a generic representation for describing transformations between algebraic data types and a non-deterministic algorithm for computing such representations. These representations can be used to give a more accurate account of modifications made to algebraic data structures - and the abstract syntax trees of computer programs in particular - as opposed to only considering modifications between their textual representations.
{"title":"Type-directed diffing of structured data","authors":"Victor Cacciari Miraldo, Pierre-Évariste Dagand, Wouter Swierstra","doi":"10.1145/3122975.3122976","DOIUrl":"https://doi.org/10.1145/3122975.3122976","url":null,"abstract":"The Unix diff utility that compares lines of text is used pervasively by version control systems. Yet certain changes to a program may be difficult to describe accurately in terms of modifications to individual lines of code. As a result, observing changes at such a fixed granularity may lead to unnecessary conflicts between different edits. This paper presents a generic representation for describing transformations between algebraic data types and a non-deterministic algorithm for computing such representations. These representations can be used to give a more accurate account of modifications made to algebraic data structures - and the abstract syntax trees of computer programs in particular - as opposed to only considering modifications between their textual representations.","PeriodicalId":166018,"journal":{"name":"Proceedings of the 2nd ACM SIGPLAN International Workshop on Type-Driven Development","volume":"4 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-09-03","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"125403645","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Algebraic effect handlers generalize many control-flow abstractions that are implemented specially in most languages, like exception handling, iterators, or backtracking. In this article, we show how we can implement full support for asynchronous programming as a library using just algebraic effect handlers. The consistent type driven approach also leads naturally to powerful abstractions like block-scoped interleaving, cancellation, and timeout's that are lacking in other major asynchronous frameworks. We also introduce the concept of ambient state to reason about state that is local to the current strand of asynchronous execution.
{"title":"Structured asynchrony with algebraic effects","authors":"Daan Leijen","doi":"10.1145/3122975.3122977","DOIUrl":"https://doi.org/10.1145/3122975.3122977","url":null,"abstract":"Algebraic effect handlers generalize many control-flow abstractions that are implemented specially in most languages, like exception handling, iterators, or backtracking. In this article, we show how we can implement full support for asynchronous programming as a library using just algebraic effect handlers. The consistent type driven approach also leads naturally to powerful abstractions like block-scoped interleaving, cancellation, and timeout's that are lacking in other major asynchronous frameworks. We also introduce the concept of ambient state to reason about state that is local to the current strand of asynchronous execution.","PeriodicalId":166018,"journal":{"name":"Proceedings of the 2nd ACM SIGPLAN International Workshop on Type-Driven Development","volume":"53 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-09-03","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"128333947","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Facebook’s main website, ads platform, and much of its internal tooling is implemented in PHP, a language not known for elegance or best practice in programming language design. Five years ago Facebook embarked on an ambitious project to migrate its code base to Hack, which takes the syntax of PHP, removes the worst features, and adds static typing and modern constructs for asynchronous programming. Its type system is an interesting mixture of ideas from Java, C#, Scala, and Caml, with flow-sensitive typing thrown in to capture typical PHP idioms. Type-driven development is now more than accepted: developers demand ever richer types, and evolution of the codebase goes hand-in-hand with evolution of the type system and programming language.
{"title":"Driving types into PHP (invited talk)","authors":"A. Kennedy","doi":"10.1145/3122975.3127322","DOIUrl":"https://doi.org/10.1145/3122975.3127322","url":null,"abstract":"Facebook’s main website, ads platform, and much of its internal tooling is implemented in PHP, a language not known for elegance or best practice in programming language design. Five years ago Facebook embarked on an ambitious project to migrate its code base to Hack, which takes the syntax of PHP, removes the worst features, and adds static typing and modern constructs for asynchronous programming. Its type system is an interesting mixture of ideas from Java, C#, Scala, and Caml, with flow-sensitive typing thrown in to capture typical PHP idioms. Type-driven development is now more than accepted: developers demand ever richer types, and evolution of the codebase goes hand-in-hand with evolution of the type system and programming language.","PeriodicalId":166018,"journal":{"name":"Proceedings of the 2nd ACM SIGPLAN International Workshop on Type-Driven Development","volume":"62 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-09-03","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"130650372","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Proceedings of the 2nd ACM SIGPLAN International Workshop on Type-Driven Development","authors":"","doi":"10.1145/3122975","DOIUrl":"https://doi.org/10.1145/3122975","url":null,"abstract":"","PeriodicalId":166018,"journal":{"name":"Proceedings of the 2nd ACM SIGPLAN International Workshop on Type-Driven Development","volume":"44 4 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"1900-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"129180741","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}