6,416 research outputs found

    Generic programming using Higher Kinded Data

    Get PDF
    This thesis describes datatype-generic programming, what it is, and how it is done in Scala. The thesis covers ways of thinking about datatype-generic programming and today's tools and libraries for datatype-generic programming in Scala and summarize how to use them. A new library called perspective for datatype-generic programming with higher kinded data is presented. How these libraries, including perspective, work together with sum types is be covered. Benchmarks are presented on both runtime and compile time performance of perspective and other libraries. perspective manages to keep up in performance with other libraries while offering faster code at the expense of longer compile time if a developer opts into this. Finally, an example language-integrated query library built on perspective is described.Masteroppgave i informatikkINF399MAMN-INFMAMN-PRO

    The generic HASKELL user's guide : version 0.99 - Amber release

    Get PDF
    Software development often consists of designing datatypes around which functionality is added. Some functionality is datatype specific, whereas other functionality is defined on almost all datatypes in such a way that it depends only on the structure of the datatype. A function that works on many datatypes in this way is called a generic (or polytypic) function. Examples of generic functionality include storing a value in a database, editing a value, comparing two values for equality, and pretty-printing a value. Since datatypes often change and new datatypes are introduced, we have developed Generic HASKELL which supports generic definitions to save the programmer from (re)writing instances of generic functions. Generic HASKELL extends the functional programming language Haskell [5] with, among other things, a construct for defining type-indexed values with kind-indexed types, based on recent work by Hinze [2]. These values can be specialised to all Haskell datatypes, facilitating wider application of generic programming than provided by earlier systems such as PolyP [4]

    A Framework for Datatype Transformation

    Get PDF
    We study one dimension in program evolution, namely the evolution of the datatype declarations in a program. To this end, a suite of basic transformation operators is designed. We cover structure-preserving refactorings, but also structure-extending and -reducing adaptations. Both the object programs that are subject to datatype transformations, and the meta programs that encode datatype transformations are functional programs.Comment: Minor revision; now accepted at LDTA 200

    The Sketch of a Polymorphic Symphony

    Full text link
    In previous work, we have introduced functional strategies, that is, first-class generic functions that can traverse into terms of any type while mixing uniform and type-specific behaviour. In the present paper, we give a detailed description of one particular Haskell-based model of functional strategies. This model is characterised as follows. Firstly, we employ first-class polymorphism as a form of second-order polymorphism as for the mere types of functional strategies. Secondly, we use an encoding scheme of run-time type case for mixing uniform and type-specific behaviour. Thirdly, we base all traversal on a fundamental combinator for folding over constructor applications. Using this model, we capture common strategic traversal schemes in a highly parameterised style. We study two original forms of parameterisation. Firstly, we design parameters for the specific control-flow, data-flow and traversal characteristics of more concrete traversal schemes. Secondly, we use overloading to postpone commitment to a specific type scheme of traversal. The resulting portfolio of traversal schemes can be regarded as a challenging benchmark for setups for typed generic programming. The way we develop the model and the suite of traversal schemes, it becomes clear that parameterised + typed strategic programming is best viewed as a potent combination of certain bits of parametric, intensional, polytypic, and ad-hoc polymorphism
    • …
    corecore