waern / blaze-react

A blaze-html style ReactJS binding for Haskell using GHCJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

blaze-react v0.1

It's recommended that you use the release-candidate for blaze-react 0.2. You can find it in the v0.2-rc1 branch.

These are experimental bindings for ReactJS using GHCJS. The rendering API is modeled analogously to blaze-html and the application architecture is based on simply specifying the complete UI state together with the state transitions that implement the application's logic.

This purity simplifies both implementation and debugging. For example one can generically implement a time-machine wrapper which wraps an application such that one can go back and inspect all intermediate states. To see it in action, take a look at the classic TodoMVC example in todomvc directory, which is also available online.

Building

First of all, make sure you have ghcjs installed (including the patched version of cabal), as well as nodejs and npm.

Blaze-react depends on ghcjs-ffiqq, which is not on hackage, so you'll have to install it from github. The suggested way is to run cabal sandbox add-source <path to a checkout of ghcjs-ffiqq>. Once this is done, you need to do a bit of fairly standard set-up, and then you can build the library:

make dev-tools
cabal install --only-dep
cabal configure
make build

If you want to build the example app as well (found in the 'todomvc' directory) then you should configure the project with the build-example flag set:

cabal configure -fbuild-example
make build
open todomvc/index.html

Known problems

  • The versions in the .cabal file are not properly pinned, which might lead to build problems.
  • The extra-sources field is missing some files, which means cabal sdist won't work.

Acknowledgements

  • The bindings were heavily inspired by Luite Stegeman's virtual-dom bindings.
  • Alex Sayers implemented the Clock and TimeMachine examples.
  • Tomas Carnekcy helped debug some nasty GHCJS FFI issues.

About

A blaze-html style ReactJS binding for Haskell using GHCJS

License:MIT License


Languages

Language:Haskell 92.0%Language:CSS 5.0%Language:JavaScript 1.9%Language:HTML 0.9%Language:Makefile 0.1%