18 research outputs found

    Entangled State Monads

    Get PDF
    We present a monadic treatment of symmetric state-based bidirectional transformations, and show how it arises naturally from the well-known asymmetric lens-based account. We introduce two presentations of a concept we dub the \"entangled\" state monad, and prove their equivalence. As a step towards a unifying account of bidirectionality in general, we exhibit existing classes of state-based approaches from the literature as instances of our new constructions. This extended abstract reports on work in progress

    Notions of Bidirectional Computation and Entangled State Monads

    Get PDF
    Bidirectional transformations (bx) support principled consistency maintenance between data sources. Each data source corresponds to one perspective on a composite system, manifested by operations to ‘get’ and ‘set’ a view of the whole from that particular perspective. Bx are important in a wide range of settings, including databases, interactive applications, and model-driven development. We show that bx are naturally modelled in terms of mutable state; in particular, the ‘set’ operations are stateful functions. This leads naturally to considering bx that exploit other computational effects too, such as I/O, nondeterminism, and failure, all largely ignored in the bx literature to date. We present a semantic foundation for symmetric bidirectional transformations with effects. We build on the mature theory of monadic encapsulation of effects in functional programming, develop the equational theory and important combinators for effectful bx, and provide a prototype implementation in Haskell along with several illustrative examples

    Is Bidirectionality Important?

    Get PDF

    Encapsulating effects

    Get PDF

    Reflections on monadic lenses

    Get PDF
    Bidirectional transformations (bx) have primarily been modeled as pure functions, and do not account for the possibility of the side-effects that are available in most programming languages. Recently several formulations of bx that use monads to account for effects have been proposed, both among practitioners and in academic research. The combination of bx with effects turns out to be surprisingly subtle, leading to problems with some of these proposals and increasing the complexity of others. This paper reviews the proposals for monadic lenses to date, and offers some improved definitions, paying particular attention to the obstacles to naively adding monadic effects to existing definitions of pure bx such as lenses and symmetric lenses, and the subtleties of equivalence of symmetric bidirectional transformations in the presence of effects
    corecore