330 research outputs found

    What Does Aspect-Oriented Programming Mean for Functional Programmers?

    Get PDF
    Aspect-Oriented Programming (AOP) aims at modularising crosscutting concerns that show up in software. The success of AOP has been almost viral and nearly all areas in Software Engineering and Programming Languages have become "infected" by the AOP bug in one way or another. Interestingly the functional programming community (and, in particular, the pure functional programming community) seems to be resistant to the pandemic. The goal of this paper is to debate the possible causes of the functional programming community's resistance and to raise awareness and interest by showcasing the benefits that could be gained from having a functional AOP language. At the same time, we identify the main challenges and explore the possible design-space

    HaskHOL: A Haskell Hosted Domain Specific Language for Higher-Order Logic Theorem Proving

    Get PDF
    HaskHOL is an implementation of a HOL theorem proving capability in Haskell. Motivated by a need to integrate theorem proving capabilities into a Haskell-based tool suite, HaskHOL began as a simple port of HOL Light to Haskell. However, Haskell's laziness, immutable data, and monadic extensions both complicate an implementation and enable a new feature class. This thesis describes HaskHOL, its motivation and implementation. Its use to implement a primitive, interactive theorem prover is explored and its performance is evaluated using a collection of intuitionistically valid problems

    Expressing functional reactive programming in C++

    Get PDF
    Abstract. Most C++ programs are written in a straight-forward imperative style. While e.g. callbacks are employed either directly or through the observer pattern, the mental overhead of keeping program state congruent is high and increases with program size. This paper presents a translation of functional reactive programming into C++ terms. This paradigm originates from the Haskell language community and seeks to express easily how programs should react to new input. Concretely, an implementation of a reactive property class is presented, where property in this context is a class holding a value of a user-specified type. The property class provides a mechanism to bind to it an expression that takes an arbitrary number of inputs, some of which can be other instances of property classes. When any of these dependent properties is updated the expression is re-evaluated, so that a dataflow graph may be built using this type. The automatic re-evaluation reduces the boilerplate code necessary to update variables, which can lead to fewer programming errors and more concise programs. The implementation demonstrates that the core principles of functional reactive programming can be expressed in modern C++. Further, the implementation can be done in an idiomatic manner which appears familiar to C++ developers. At the same time, the implementation’s complexity highlights how much further the C++ meta-programming facilities must be developed to properly support facilities such as a functional reactive programming library implementation. A number of compile-time template metaprogramming utilities used in the implementation are also introduced

    Monadic Augment And Generalized Short Cut Fusion

    Get PDF
    Monads are commonplace programming devices that are used to uniformly structure computations;in particular, they are often used to mimic the effects of impure features suchas state, error handling, and I/O. This paper further develops the monadic programmingparadigm by investigating the extent to which monadic computations can be optimisedby using generalisations of short cut fusion to eliminate monadic structures whose solepurpose is to \glue together" monadic program components.Ghani, Uustalu, and Vene have recently shown that every inductive type has an associatedbuild combinator and an associated short cut fusion rule. They have also used thenotion of a parameterised monad to describe those monads that give rise to inductive types,and have shown that the standard augment combinators and cata/augment fusion rulesfor algebraic data types can be generalised to xed points of all parameterised monads.We revisit these augment combinators and generalised short cut fusion rules for such typesbut consider them from a functional programming perspective, rather than a categoricalone. In addition to making the category-theoretic ideas of Ghani, Uustalu, and Venemore easily accessible to a wider audience of functional programmers, we demonstratetheir practical applicability by developing nontrivial application programs and performingmodest benchmarking on them. We also show how the cata/augment rules can serve asthe basis for deriving additional generic fusion laws, thus opening the way for an algebraof fusion. Finally, we oer deep theoretical insights, arguing that the augment combinatorsare monadic in nature, and thus that the cata/build and cata/augment rules arearguably the best generally applicable fusion rules obtainable

    Synthesizing Functional Reactive Programs

    Get PDF
    Functional Reactive Programming (FRP) is a paradigm that has simplified the construction of reactive programs. There are many libraries that implement incarnations of FRP, using abstractions such as Applicative, Monads, and Arrows. However, finding a good control flow, that correctly manages state and switches behaviors at the right times, still poses a major challenge to developers. An attractive alternative is specifying the behavior instead of programming it, as made possible by the recently developed logic: Temporal Stream Logic (TSL). However, it has not been explored so far how Control Flow Models (CFMs), as synthesized from TSL specifications, can be turned into executable code that is compatible with libraries building on FRP. We bridge this gap, by showing that CFMs are indeed a suitable formalism to be turned into Applicative, Monadic, and Arrowized FRP. We demonstrate the effectiveness of our translations on a real-world kitchen timer application, which we translate to a desktop application using the Arrowized FRP library Yampa, a web application using the Monadic threepenny-gui library, and to hardware using the Applicative hardware description language ClaSH.Comment: arXiv admin note: text overlap with arXiv:1712.0024

    A principled approach to programming with nested types in Haskell

    Get PDF
    Initial algebra semantics is one of the cornerstones of the theory of modern functional programming languages. For each inductive data type, it provides a Church encoding for that type, a build combinator which constructs data of that type, a fold combinator which encapsulates structured recursion over data of that type, and a fold/build rule which optimises modular programs by eliminating from them data constructed using the buildcombinator, and immediately consumed using the foldcombinator, for that type. It has long been thought that initial algebra semantics is not expressive enough to provide a similar foundation for programming with nested types in Haskell. Specifically, the standard folds derived from initial algebra semantics have been considered too weak to capture commonly occurring patterns of recursion over data of nested types in Haskell, and no build combinators or fold/build rules have until now been defined for nested types. This paper shows that standard folds are, in fact, sufficiently expressive for programming with nested types in Haskell. It also defines buildcombinators and fold/build fusion rules for nested types. It thus shows how initial algebra semantics provides a principled, expressive, and elegant foundation for programming with nested types in Haskell

    Evolving a DSL implementation

    Get PDF
    Domain Specific Languages (DSLs) are small languages designed for use in a specific domain. DSLs typically evolve quite radically throughout their lifetime, but current DSL implementation approaches are often clumsy in the face of such evolution. In this paper I present a case study of an DSL evolving in its syntax, semantics, and robustness, implemented in the Converge language. This shows how real-world DSL implementations can evolve along with changing requirements
    corecore