Daniel Fridlender, Alejandro Gadea, Miguel Pagano, Leonardo Rodríguez
In this paper we extend the technique of biorthogonality for proving the correctness of a compiler for a lazy language, which, as far as we know, has only been preliminary explored by Rodríguez [19]. One of the technical difficulties arising in this context is the sharing of the heap between the realizer and the test. We significantly extend the language considered by Rodríguez by adding integer numbers and products, which may be used as a test case for tackling other data-types. Our language does not yet support recursive definitions.
{"title":"Biorthogonality for a Lazy language","authors":"Daniel Fridlender, Alejandro Gadea, Miguel Pagano, Leonardo Rodríguez","doi":"10.1145/3205368.3205374","DOIUrl":"https://doi.org/10.1145/3205368.3205374","url":null,"abstract":"In this paper we extend the technique of biorthogonality for proving the correctness of a compiler for a lazy language, which, as far as we know, has only been preliminary explored by Rodríguez [19]. One of the technical difficulties arising in this context is the sharing of the heap between the realizer and the test. We significantly extend the language considered by Rodríguez by adding integer numbers and products, which may be used as a test case for tackling other data-types. Our language does not yet support recursive definitions.","PeriodicalId":180839,"journal":{"name":"Proceedings of the 29th Symposium on the Implementation and Application of Functional Programming Languages","volume":"57 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-08-30","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"116028566","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 effects and handlers are a convenient method for structuring monadic effects with primitive effectful operations and separating the syntax from the interpretation of these operations. However, the scope of conventional handlers are somewhat limited as not all side effects are monadic in nature. This paper generalizes the notion of algebraic effects and handlers from monads to generalized monoids, which notably covers applicative functors and arrows. For this purpose we switch the category theoretical basis from free algebras to free monoids. In addition, we show how lax monoidal functors enable the reuse of handlers and programs across different computation classes, for example handling applicative computations with monadic handlers.
{"title":"Handlers for Non-Monadic Computations","authors":"Ruben P. Pieters, T. Schrijvers, Exequiel Rivas","doi":"10.1145/3205368.3205372","DOIUrl":"https://doi.org/10.1145/3205368.3205372","url":null,"abstract":"Algebraic effects and handlers are a convenient method for structuring monadic effects with primitive effectful operations and separating the syntax from the interpretation of these operations. However, the scope of conventional handlers are somewhat limited as not all side effects are monadic in nature. This paper generalizes the notion of algebraic effects and handlers from monads to generalized monoids, which notably covers applicative functors and arrows. For this purpose we switch the category theoretical basis from free algebras to free monoids. In addition, we show how lax monoidal functors enable the reuse of handlers and programs across different computation classes, for example handling applicative computations with monadic handlers.","PeriodicalId":180839,"journal":{"name":"Proceedings of the 29th Symposium on the Implementation and Application of Functional Programming Languages","volume":"61 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-08-30","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"124044503","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}
Arjan Oortgiese, John H. G. van Groningen, P. Achten, M. J. Plasmeijer
Task Oriented Programming (TOP) is a special flavor of functional programming for real-world application domains in which people and automated systems collaborate to achieve a common goal. The original iTasks framework, which implements TOP, uses a single server multi-client architecture. This is not suited for truly distributed application domains, such as deployed by the Dutch coast guard. In this paper we show how to turn this architecture into a distributed, dynamic, architecture. This is done in an elegant way, by building on the core concepts of TOP and iTasks.
{"title":"A Distributed Dynamic Architecture for Task Oriented Programming","authors":"Arjan Oortgiese, John H. G. van Groningen, P. Achten, M. J. Plasmeijer","doi":"10.1145/3205368.3205375","DOIUrl":"https://doi.org/10.1145/3205368.3205375","url":null,"abstract":"Task Oriented Programming (TOP) is a special flavor of functional programming for real-world application domains in which people and automated systems collaborate to achieve a common goal. The original iTasks framework, which implements TOP, uses a single server multi-client architecture. This is not suited for truly distributed application domains, such as deployed by the Dutch coast guard. In this paper we show how to turn this architecture into a distributed, dynamic, architecture. This is done in an elegant way, by building on the core concepts of TOP and iTasks.","PeriodicalId":180839,"journal":{"name":"Proceedings of the 29th Symposium on the Implementation and Application of Functional Programming Languages","volume":"16 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-08-30","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"124065487","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}
Parallel computations in a program can be expressed conveniently, at a high level of abstraction, using parallel patterns such as task farm, pipeline or divide-and-conquer. In order to transform a sequential program into a pattern-based parallel one, the software developer may want to apply refactoring transformations on it. This tutorial explains a methodology to perform tool supported parallelization of programs by presenting how to use a specific static source code analysis and transformation system for Erlang. A key element of the approach is pattern candidate discovery, a static analysis technique to identify code fragments that can be refactored into a parallel pattern.
{"title":"Pattern Candidate Discovery and Parallelization Techniques","authors":"M. Tóth, István Bozó, T. Kozsik","doi":"10.1145/3205368.3205369","DOIUrl":"https://doi.org/10.1145/3205368.3205369","url":null,"abstract":"Parallel computations in a program can be expressed conveniently, at a high level of abstraction, using parallel patterns such as task farm, pipeline or divide-and-conquer. In order to transform a sequential program into a pattern-based parallel one, the software developer may want to apply refactoring transformations on it. This tutorial explains a methodology to perform tool supported parallelization of programs by presenting how to use a specific static source code analysis and transformation system for Erlang. A key element of the approach is pattern candidate discovery, a static analysis technique to identify code fragments that can be refactored into a parallel pattern.","PeriodicalId":180839,"journal":{"name":"Proceedings of the 29th Symposium on the Implementation and Application of Functional Programming Languages","volume":"135 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-08-30","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"124225927","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}
Xeon Phi is the common brand name of Intel's Many Integrated Core (MIC) architecture. The first commercially available generation Knights Corner and the second generation Knights Landing form a middle ground between modestly parallel desktop and standard server processor architectures and the massively parallel GPGPU architectures. In this paper we explore various compilation strategies for the purely functional data-parallel array language SAC (Single Assignment C) to support both MIC architectures in the presence of entirely resource- and target-agnostic source code. Our particular interest lies in doing so with limited, or entirely without, user knowledge about the target architecture. We report on a series of experiments involving two classical benchmarks, Matrix Multiplication and Gaussian Blur, that demonstrate the level of performance that can be expected from compilation of abstract, purely functional source code to the Xeon Phi family of architectures.
{"title":"Towards Compiling SAC for the Xeon Phi Knights Corner and Knights Landing Architectures: Strategies and Experiments","authors":"C. Grelck, N. Sarris","doi":"10.1145/3205368.3205377","DOIUrl":"https://doi.org/10.1145/3205368.3205377","url":null,"abstract":"Xeon Phi is the common brand name of Intel's Many Integrated Core (MIC) architecture. The first commercially available generation Knights Corner and the second generation Knights Landing form a middle ground between modestly parallel desktop and standard server processor architectures and the massively parallel GPGPU architectures. In this paper we explore various compilation strategies for the purely functional data-parallel array language SAC (Single Assignment C) to support both MIC architectures in the presence of entirely resource- and target-agnostic source code. Our particular interest lies in doing so with limited, or entirely without, user knowledge about the target architecture. We report on a series of experiments involving two classical benchmarks, Matrix Multiplication and Gaussian Blur, that demonstrate the level of performance that can be expected from compilation of abstract, purely functional source code to the Xeon Phi family of architectures.","PeriodicalId":180839,"journal":{"name":"Proceedings of the 29th Symposium on the Implementation and Application of Functional Programming Languages","volume":"47 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-08-30","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"126523602","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}
Artjoms Šinkarovs, S. Scholz, Robert J. Stewart, Hans-Nikolai Vießmann
Recursive value definitions in the context of functional programming languages that are based on a call-by-value semantics are known to be challenging. A lot of prior work exists in the context of languages such as Scheme and OCaml. In this paper, we look at the problem of recursive array definitions within a call-by-value setting. We propose a solution that enables recursive array definitions as long as there are no cyclic dependences between array elements. The paper provides a formal semantics definition, sketches possible compiler implementations and relates to a prototypical implementation of an interpreter in OCaml. Furthermore, we briefly discuss how this approach could be extended to other data structures and how it could serve as a basis to further extend mutually recursive value definitions in a call-by-value setting in general.
{"title":"Recursive Array Comprehensions in a Call-by-Value Language","authors":"Artjoms Šinkarovs, S. Scholz, Robert J. Stewart, Hans-Nikolai Vießmann","doi":"10.1145/3205368.3205373","DOIUrl":"https://doi.org/10.1145/3205368.3205373","url":null,"abstract":"Recursive value definitions in the context of functional programming languages that are based on a call-by-value semantics are known to be challenging. A lot of prior work exists in the context of languages such as Scheme and OCaml. In this paper, we look at the problem of recursive array definitions within a call-by-value setting. We propose a solution that enables recursive array definitions as long as there are no cyclic dependences between array elements. The paper provides a formal semantics definition, sketches possible compiler implementations and relates to a prototypical implementation of an interpreter in OCaml. Furthermore, we briefly discuss how this approach could be extended to other data structures and how it could serve as a basis to further extend mutually recursive value definitions in a call-by-value setting in general.","PeriodicalId":180839,"journal":{"name":"Proceedings of the 29th Symposium on the Implementation and Application of Functional Programming Languages","volume":"295 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-08-30","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"134139388","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}
In this paper we present a static analysis for costs of higher-order workflows, where costs are maps from resource types to simple functions over time. We present a type and effect system together with an algorithm that yields safe approximations for the cost functions of programs.
{"title":"The Sky is the Limit: Analysing Resource Consumption Over Time Using Skylines","authors":"M. Klinik, J. M. Jansen, M. J. Plasmeijer","doi":"10.1145/3205368.3205376","DOIUrl":"https://doi.org/10.1145/3205368.3205376","url":null,"abstract":"In this paper we present a static analysis for costs of higher-order workflows, where costs are maps from resource types to simple functions over time. We present a type and effect system together with an algorithm that yields safe approximations for the cost functions of programs.","PeriodicalId":180839,"journal":{"name":"Proceedings of the 29th Symposium on the Implementation and Application of Functional Programming Languages","volume":"17 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-08-30","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"115134820","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}
This paper presents a new tool called Extrapolate that automatically generalizes counterexamples found by property-based testing in Haskell. Example applications show that generalized counterexamples can inform the programmer more fully and more immediately what characterises failures. Extrapolate is able to produce more general results than similar tools. Although it is intrinsically unsound, as reported generalizations are based on testing, it works well for examples drawn from previous published work in this area.
{"title":"Extrapolate: generalizing counterexamples of functional test properties","authors":"Rudy Matela, C. Runciman","doi":"10.1145/3205368.3205371","DOIUrl":"https://doi.org/10.1145/3205368.3205371","url":null,"abstract":"This paper presents a new tool called Extrapolate that automatically generalizes counterexamples found by property-based testing in Haskell. Example applications show that generalized counterexamples can inform the programmer more fully and more immediately what characterises failures. Extrapolate is able to produce more general results than similar tools. Although it is intrinsically unsound, as reported generalizations are based on testing, it works well for examples drawn from previous published work in this area.","PeriodicalId":180839,"journal":{"name":"Proceedings of the 29th Symposium on the Implementation and Application of Functional Programming Languages","volume":"15 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-08-30","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"128146189","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}
Embedded domain specific languages (DSLs) are a common pattern in the functional programming world, providing very high-level abstractions to programmer. Unfortunately, this abstraction is broken when type errors occur, leaking details of the DSL implementation. In this paper we present a set of techniques for customizing type error diagnosis in order to avoid this leaking. These techniques have been implemented in the GHC Haskell compiler. Our customizations are declared in the type signatures of functions provided by the DSL, leading to type error message that are context-dependent: the same kind of error can be reported in a different way depending on the particular expression in which it occurs. We make use of the ability to manipulate constraints using type-level programming which is already present in GHC, and which enables reuse and abstraction of common type error patterns.
{"title":"Type Error Customization in GHC: Controlling expression-level type errors by type-level programming","authors":"A. Serrano, Jurriaan Hage","doi":"10.1145/3205368.3205370","DOIUrl":"https://doi.org/10.1145/3205368.3205370","url":null,"abstract":"Embedded domain specific languages (DSLs) are a common pattern in the functional programming world, providing very high-level abstractions to programmer. Unfortunately, this abstraction is broken when type errors occur, leaking details of the DSL implementation. In this paper we present a set of techniques for customizing type error diagnosis in order to avoid this leaking. These techniques have been implemented in the GHC Haskell compiler. Our customizations are declared in the type signatures of functions provided by the DSL, leading to type error message that are context-dependent: the same kind of error can be reported in a different way depending on the particular expression in which it occurs. We make use of the ability to manipulate constraints using type-level programming which is already present in GHC, and which enables reuse and abstraction of common type error patterns.","PeriodicalId":180839,"journal":{"name":"Proceedings of the 29th Symposium on the Implementation and Application of Functional Programming Languages","volume":"11 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-08-30","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"129867020","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}