Giter Club home page Giter Club logo

purescript-digest's Introduction

PureScript Digestive Computations

Digest cycles are computations that support reading a context value (the input), accumulating a monoidal view of the context (the view), and possibly producing a final result (the result). One application of them is to implement composable forms, where the validation logic and UI are run simultaneously.

The idea is based loosely on the Formlets introduced in (The Essence of Form Abstraction)[http://www.ezrakilty.net/pubs/formlets.pdf] by Cooper, Lindley, Wadlerm and Yallop, altough this implementation includes a mechanism for failed validation as well as the ability to run computations in an arbitrary base monad via a monad transformer, DigestT.

The name Digest is taken from the (digestive-functors)[https://hackage.haskell.org/package/digestive-functors] Haskell package, though it should be noted that the design of the types and API are radically different in this library. Notably, the DigestT monad does not impose any structure on the view type beyond requiring a Monoid instance. This makes the API more general, but less domain-specific. As such, it is an appropriate choice to build domain-specific form libraries that target particular frameworks and design systems, allowing it to be tailored to the specific use case more easily.

Overview

The library provides the DigestT and Digest types, the latter of which is DigestT applied to the Identity base monad.

A Digest action can be thought of combining the abilities of Reader, Writer, and Maybe. Input can be accessed at any point in the computation, and modified locally like Reader. The view can be appended to at any point in the computation, as well as manipulated directly like Writer. Finally, the computation can short-circuit and fail with an empty result, yeilding the view accumulated so far. This ability enables things like form validation and wizards naturally.

purescript-digest's People

Contributors

jhbertra avatar

Watchers

Mathieu Boespflug avatar Tim Sears avatar Chuck Grindel avatar Alexander Vershilov avatar Richard Bullington-McGuire avatar Yogesh Sajanikar avatar Gregg Reynolds avatar Clément Hurlin avatar Manuel M T Chakravarty avatar Nicolas Frisby avatar Facundo Domínguez avatar Arnaud Spiwack avatar Mark Potter avatar Malte Poll avatar Claudio Bley avatar Yves-Stan Le Cornec avatar Yann Hamdaoui avatar Mark Karpov avatar Andy D avatar George Karachalias avatar  avatar Vince avatar Tom Westerhout avatar Tanya Bouman avatar Mathieu Montin avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.