CENTRAL – EUROPEAN FUNCTIONAL PROGRAMMING SCHOOL

CEFP SUMMER SCHOOL SERIES

Eötvös Loránd University

 

Home

Programme
Schedule
Abstracts and materials

PhD Workshop
Schedule
Abstracts

Registration

Contact

Jurrien Stutterheim, Peter Achten, Rinus Plasmeijer: A Graphical Tracer and Debugger for Designers, Programmers and End-Users of Task Oriented Applications

In Task Oriented Programming (TOP), tasks, as performed by both humans and computers, are the core concept. TOP is offered by the iTask system (iTasks) as a shallowly embedded Domain Specific Language (DSL) in the pure functional programming language Clean.

In iTasks, arbitrary complex multi-user / multi-systems collaborations over the internet can be defined.

From the specification an application is generated which coordinates the work thus described over the internet. The description is very concise: one can focus on the description of the tasks to do and abstract from the many technical details (e.g. user interface generation, code to run on the client or server, client-server communication and synchronization) one commonly has to define explicitly.

iTasks is used in industry for rapid prototyping in complex sociotechnical domains such as command and control systems. However, for non-technical industrial stakeholders or end-users of the system, formal task (function) definitions as given in a pure functional language are commonly too difficult to understand. They are more used to communicate their ideas informally, using drawings and natural language, while TOP programmers model tasks as functions in Clean.

To bridge the gap we want to offer a simplified graphical view of an iTask program that can be used to communicate ideas between designers and programmers when developing an iTask application. Furthermore we want to show graphically how tasks are evolving at run-time, showing developers but also end-users what is actually happening, such that they can react in a proper way to the situations that occur.

In this talk we present the TONIC graphical tracer and debugger for iTasks. It uses a special Clean compiler which generates additional information for monad-like structures such as task definitions. This information is used to show static blueprints: a simplified graphical representation of the tasks being defined, a kind of parameterized flow graphs. When tasks are started at run-time, the static blueprints are instantiated into dynamic blueprints.  These show which tasks are actually being performed, which one are finished, or which still have to be done. Arguments and results of tasks can be inspected, not only from finished tasks but also from tasks one is currently working on. TONIC enables designers, developers, and end-users to inspect the task definitions and run-time behavior which can be used to further improve the application.

Pieter Koopman and Rinus Plasmeijer: A Shallow Embedded Type Safe Extendable DSL for the Arduino

In this paper we describe a shallow embedded type safe extendable domain specific language to program a microprocessor system. Our long term goal is to run parts of Clean programs that require special input/output actions on such a microprocessor.

We use a number of new implementation techniques to make this domain specific language type safe and extendable. It is type safe since ever program in the domain specific language approved by the compiler of the host language is also well type in the C-dialect of the microprocessor. The language is extendable since we can add language constructs or views without touching existing code. This makes it a successful solution for Wadler's expression problem.

Adam Granicz: Functional, Reactive Web Programming in F#

In this lecture, we will take a look at the basics of functional and reactive web programming through WebSharper – a mature web development stack for F#, and it’s UI.Next library for reactive DOM construction and dynamic dataflow. You will learn the theory behind similar technologies, discover its advantages, and develop simple applications using the concepts learned.

Tamás Kozsik: Parallelization by Refactoring

Refactoring is the process of restructuring, shaping or transforming a program in order to improve its quality, to change its non-functional properties, or to make it suitable to add a new feature. This activity can be carried out by hand, or by using program transformation tools. One possible application area of refactoring is the introduction of parallelism into sequential programs. When parallelizing industrial-scale software applications, a tool can provide invaluable help in decision making as well as in the semi-automatic application of refactoring transformations. Such a tool should offer guidance to its user on what refactoring decisions are to be made, on where it is the most fruitful to introduce parallelism, and on how to achieve the desired program structure.

A modern, structured design and implementation approach for parallel programming allows developers exploit a variety of high-level parallel patterns to develop component-based applications that can be mapped to the available hardware resources, and which may then be dynamically re-mapped to meet application needs and hardware availability. This tutorial presents tools and techniques that can (semi-)automatically locate suitable pattern candidates in Erlang programs, and recommend transformed versions of these pattern candidates that yield significant speedup on a given parallel architecture.

Ivan Čukić: Functional Reactive Programming for C++

Functional reactive programming is a discipline which tries to bring cleaner and safer ways to develop asynchronous systems. It is suitable for writing all kinds of event-based systems, or any type of system where separate components need to be executed asynchronously, but still need to communicate with each other. This includes web services and distributed systems, but also regular consumer GUI applications.

Reactive programming creates abstractions on top of various low-level approaches for asynchronous execution such as threads, actors, callbacks and such. Those abstractions extend the commonly used higher-order functional programming concepts to be applicable to concurrent systems.

We will present a couple of reactive programming idioms with their implementations and examples in the C++14 language, along with their counter-parts in 'real' functional languages like Haskell. We will also take a look at the evolution of C++, with a special attention given to a few upcoming features planned for C++17.

Rainer Grimm: Programming in a Functional Style in Modern C++

C++ is a multi paradigm programming language. So the programmer may choose and combine between structural, procedural, object oriented, generic or functional features of C++ to solve his problem. Especially the functional aspect of C++ with lambda functions, type inference and the function std::bind and std::function has grown in modern C++ and is still evolving with the next C++ standards.

This lecture gives an overview of the functional capabilities of modern C++, compares this features with that of Haskell and shows, how you can use them. In addition, the lecture tries to peek in the future and gives an idea of what to come in the near future.

Clemens Grelck: Single Assignment C: From Functional Programming with Curly Brackets to High Performance Computing

SAC (Single Assignment C) is in several aspects a functional programming language out of the ordinary. As the name suggests, SAC combines a C-like syntax (with lots of curly brackets) with a state-free, purely functional semantics. Originally motivated to ease adoption by programmers with an imperative background, the choice offers surprising insights into what constitutes a "typical" functional or a "typical" imperative language construct.

Again on the exotic side, SAC does not favour lists and trees, or more generally algebraic data types, but puts all emphasis on multi-dimensional arrays as the primary data structure. Based on a formal array calculus SAC supports declarative array processing in the spirit of interpreted languages such as APL. Array programming treats multidimensional arrays in a holistic way: functions map potentially huge argument array values into result array values following a call-by-value semantics and new array operations are defined by composition of existing ones.

SAC is a high-productivity language for application domains that deal with large collections of data in a computationally intensive way. At the same time SAC also is a high performance language competing with low-level imperative languages through compilation technology. The abstract view on arrays combined with the functional semantics support far-reaching program transformations. A highly optimised runtime system takes care of automatic memory management with an emphasis on immediate reuse. Last not least, the SAC compiler exploits the state-free semantics of SAC and the data-parallel nature of SAC programs for fully compiler-directed acceleration on contemporary multi- and many-core architectures.

João Paulo Fernandes: Keep Your Modular Programs Efficient Through Deforestation

Many reasons contribute to the beauty and effectiveness of functional programming.

In his 1990 paper on Why Functional Programming Matters, John Hughes already synthesized modularity as being one such fundamental reason. Back in 1990, Hughes claimed that two characteristics of modern functional languages have essential contributions to modularity: higher-order functions and lazy evaluation. With higher-order functions we can explore generic program schemes, or patterns, which can be reused and instantiated multiple times; in a lazy setting we can search ideal candidates in a potentially infinite search space (created lazily).

A modular setting is particularly convenient for programmers: it eases the programming task itself, encourages reuse, facilitates analysis and debugging. But such a setting may also entail a drawback: as it encourages a compositional style of programming where non-trivial solutions are constructed composing simple functions, intermediate structures need to be constructed to serve as connectors of such functions. And constructing, traversing and destroying these data structures may degrade the performance of the resulting implementations.

From a practical perspective we, as programmers, would like to build solutions that are as modular as possible, but without incurring on any performance penalties. The purpose of this tutorial is to go through several state-of-the-art transformational approaches for achieving this practical goal. We exploit the equational reasoning that is offered by functional languages in order to transform modular programs into deforested ones, i.e., into programs that do not construct any intermediate structure.

The beauty of these approaches is that, again, higher-order functions and laziness play an essential role. Indeed, 1) the programs we are able to transform are first expressed in terms of well known higher-order program schemes and 2) some of the programs we derive from them rely on higher-order functions or on lazy evaluation to be executed.

Lab materials: (pdf) and (lhs)

Štefan Korečko: Functional Languages in Design of Coloured Petri Nets Models

Coloured Petri nets (CPN) represent a formal method that allows to create sophisticated event-driven models. In addition, there exists a software tool, called CPN Tools, which provides a support for creation, simulation and state space-based verification of CPN models. An interesting feature of CPN Tools is that is uses CPN ML, a slightly modified version of the Standard ML functional language, for data manipulation. A full power of Standard ML is at disposal and it is up to the modeller how extensively he will use the language in his models. In this short tutorial we introduce basic concepts of Coloured Petri nets and show how CPN ML fits into these concepts. The participants will also have a chance to develop their own CPN models.

Zoltán Porkoláb: Immutable Programming in C++

The C++ programming language is a multiparadigm language, with a rich set of procedural, object-oriented, generative and (since C++11) functional language elements. The language is also well-known about its capability to map certain semantic features into the language syntax, therefore the compiler can reason about them in compilation time. Const-correctness is one of such aspects: the programmer can mark immutable components and the compiler checks any potential violation scenarios and also can optimize the code.

We will overview the immutable and the functional features of the modern C++ language: the relaxed constexpr (since C++14), the generalized lambda expressions (since C++14), usage of immutable containers. We will show how to program in C++ in “functional style”, and when to use mutable. We also discuss the fundamentals of C++ template metaprogramming – a pure functional paradigm at compilation time.