yamafaktory / reflex-starter

A simple starter project for building Reflex applications with Stack.
BSD 3-Clause "New" or "Revised" License
36 stars 3 forks source link

reflex-starter Build Status

A simple starter project for building Reflex applications with Stack.

If you don't know what Reflex is, please refer to the main repository in order to get an overview of the framework and then to the awesome Reflex Platform tutorial to get your hands dirty right away.

Reflex is built on top of GHCJS which is a Haskell to JavaScript compiler. A lot of modern Haskell features are available through GHCJS which makes it a really good contestant against Elm or PureScript (especially if you want to stick with Haskell).

Prerequisite

Stack

Install Stack as described in the how-to-install section of the FAQ.

NodeJS

GHCJS needs NodeJS to be installed, and a recent version.

The easiest way to go is to use nvm and to install one of the 5.x.x versions.

Installation

Clone this repository.

git clone https://github.com/yamafaktory/reflex-starter

Install GHCJS from source and boot it (go grab a coffee, a long one).

stack setup

Usage

Build the default project.

stack build

Go to the .stack-work directory and search for the reflex-starter.jsexe subdirectory, e.g.:

.stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/reflex-starter/reflex-starter.jsexe/index.html

Open the index.html in your browser and enjoy!

Updating the GHCJS version

Open the stack.yml file and replace the compiler version and the GHCJS source to match a newer released version of Luite's builds. You just have to change the date (20160416) three times.

compiler: ghcjs-0.2.0.20160416_ghc-7.10.2
compiler-check: match-exact
setup-info:
  ghcjs:
    source:
      ghcjs-0.2.0.20160416_ghc-7.10.2:
        url: "http://ghcjs.luite.com/master-20160416.tar.gz"

GHCJSi bonus

With the recent GHCJS builds, the GHCJSi REPL is now available!

stack ghci

Stack issues

Please check both the Stack's issue tracker and the Stack's FAQ first before creating an issue.

Be sure to be have an up-to-date Stack version, this could be easily achieved by running the following command:

stack upgrade --git

Setup command

If the following error message is thrown during the stack setup step:

The program 'ghc' is required but it could not be found

You probably need to check your $PATH variable (see this issue).

Build command

If you get issues during the stack build step, please try to remove your ~/.stack directory and also the .stack-work directory within the project's directory as explained in the Stack's FAQ.

License

Released under the BSD-3 license.