Giter Site home page Giter Site logo

apapacy / redux-purescript-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from osener/redux-purescript-example

0.0 2.0 0.0 68 KB

Purely functional Redux actions and reducers with PureScript.

License: Creative Commons Zero v1.0 Universal

JavaScript 75.85% HTML 1.24% PureScript 22.92%

redux-purescript-example's Introduction

Redux PureScript Example

screenshot

About

This project is a work-in-progress example/boilerplate demonstrating my attempt to write Redux reducers and actions in PureScript.

Motivation

Browser apps are getting ever so complicated as browsers gain new capabilities and move from simple document viewers to full-fledged app platforms. We need better tools as plain JS is just not enough to deal with this complexity.

Writing your business logic and parts of your app interacting with the outside world (e.g. AJAX requests) in languages like Haskell or PureScript makes a huge difference. They help you manage side effects, avoid callback hell, create testable code, and use libs like QuickCheck. This is my attempt to find a sweet spot which can reduce the surface area for bugs to linger while still benefiting from the great tooling React and Redux ecosystem offers.

Important bits

  • You can dispatch actions written in PureScript. These are defined using Redux.Action.action and Redux.Action.asyncAction utility functions found in purescript-redux-utils. See purs/Actions.purs for some examples.
  • You can write your reducers in PureScript. Use Redux.Reducer.reducer utility function to define them (also from purescript-redux-utils). See purs/Reducers.purs for some examples.
  • Components are created using React and JSX.
  • Hot reloading and Redux devtools!

Installation

git clone https://github.com/osener/redux-purescript-example.git
cd redux-purescript-example
bower install
npm install
npm start
open http://localhost:3000

TODOs

  • Try to reintroduce some of the type safety sacrificed for ease of use from JS
  • Investigate whether Immutable.js would be useful for this
  • Investigate using TypeScript or Flow for JS bits (maybe generate type definitions?)
  • Improve the example code by adding useful stuff like routing, CSS, etc.
  • Implement a more real-world(ish) app (TodoMVC?)

Thanks

  • @gaearon for Redux and a bunch of other tools that improve the state of front-end development. This project is based on react-transform-boilerplate, and all of the caveats mentioned in its README apply to this project as well.

License

CC0 (public domain)

redux-purescript-example's People

Contributors

allevo avatar arve0 avatar bit3725 avatar borisyankov avatar chentsulin avatar clessg avatar clkao avatar danmartinez-mw avatar davidhouweling avatar gaearon avatar hugooliveirad avatar ianmcnally avatar jamiebuilds avatar joearasin avatar justingreenberg avatar n1ghtmare avatar osener avatar prayagverma avatar rf- avatar ryanwholey avatar shidhincr avatar tylerhellner avatar zillding avatar

Watchers

 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.