778 research outputs found

    Generic Programming with Multiple Parameters

    Full text link

    RepLib: A library for derivable type classes

    Get PDF
    Some type class instances can be automatically derived from the structure of types. As a result, the Haskell language includes the deriving mechanism to automatic generates such instances for a small number of built-in type classes. In this paper, we present RepLib, a GHC library that enables a similar mechanism for arbitrary type classes. Users of RepLib can define the relationship between the structure of a datatype and the associated instance declaration by a normal Haskell functions that pattern-matches a representation types. Furthermore, operations defined in this manner are extensible-instances for specific types not defined by type structure may also be incorporated. Finally, this library also supports the definition of operations defined by parameterized types

    Functional programming and program transformation with interaction nets

    Get PDF
    Techon. Report DI-PURe 05.05.02.In this paper we propose to use Interaction Nets as a formalism for Visual Functional Programming. We consider the use of recursion patterns and introduce a suitable archetype/instantiation mechanism for interaction agents. We also consider program transformation by fusion, a well-known transformation technique, and show that this extends smoothly to our visual programming framework. Examples of applying this technique include transformations of two-pass functions into single-pass ones, and the introduction of accumulations

    When do datatypes commute?

    Get PDF

    A generic theory of datatypes

    Get PDF

    A Refinement Calculus for Logic Programs

    Get PDF
    Existing refinement calculi provide frameworks for the stepwise development of imperative programs from specifications. This paper presents a refinement calculus for deriving logic programs. The calculus contains a wide-spectrum logic programming language, including executable constructs such as sequential conjunction, disjunction, and existential quantification, as well as specification constructs such as general predicates, assumptions and universal quantification. A declarative semantics is defined for this wide-spectrum language based on executions. Executions are partial functions from states to states, where a state is represented as a set of bindings. The semantics is used to define the meaning of programs and specifications, including parameters and recursion. To complete the calculus, a notion of correctness-preserving refinement over programs in the wide-spectrum language is defined and refinement laws for developing programs are introduced. The refinement calculus is illustrated using example derivations and prototype tool support is discussed.Comment: 36 pages, 3 figures. To be published in Theory and Practice of Logic Programming (TPLP

    Efficient annotated terms

    Get PDF
    • …
    corecore