Giter VIP home page Giter VIP logo

try-stack-reflex's Introduction

try-stack-reflex

using stack latest ghcjs support to effortlessly compile reflex-todomvc

Setup

make sure you have installed stack >= 0.1.8 https://github.com/commercialhaskell/stack

git clone https://github.com/luigy/try-stack-reflex
cd try-stack-reflex

ghcjs-0.2 (aka improved-base)

stack setup
stack build
echo $(stack path --local-install-root)/bin/reflex-todomvc.jsexe/index.html

ghcjs-0.1

./try-stack-reflex old

or

STACK_YAML=stack-ghcjs-old-base.yaml
stack setup
stack build

# path to generated index.html to open in you browser
echo $(stack path --local-install-root)/bin/reflex-todomvc.jsexe/index.html

ghcjs --interactive

video demo

# vanilla ghcjs repo
./try-stack-reflex ghcjsi

# or a fork with ghcjsi support updated ~ 02/01/2016
./try-stack-reflex ghcjsi-fork
export NODE_PATH="$(pwd)/reflex-todomvc/node_modules"
cd reflex-todomvc
stack ghci

# open browser at localhost:6400

Caveats

requires having ghc compiler in your PATH commercialhaskell/stack#1258

try-stack-reflex's People

Contributors

luigy avatar vertexcite avatar

Stargazers

Jason Shipman avatar Jan-Philip Loos avatar aiya000 avatar jelly avatar Andrew Darqui avatar junji hashimoto avatar Aistis Raulinaitis avatar Jisoo Park avatar Sean Lee avatar David Johnson avatar Paul Chiusano avatar Brian Sunter avatar Cies Breijs avatar Davy Duperron avatar Michael Xavier avatar Erik Kaplun avatar  avatar Bryan Garza avatar Chris A. avatar  avatar Shamil Fattakhov avatar  avatar Vasiliy avatar Elliot Cameron avatar

Watchers

Paul Chiusano avatar Clint Moore avatar Steven Michael Williams avatar Shamil Fattakhov avatar Franklin Chen avatar  avatar James Cloos avatar Elliot Cameron avatar Brian Sunter avatar  avatar

try-stack-reflex's Issues

Did not build too effortlessly :)

Needed to:

sudo apt-get install dh-autoreconf
(cd /; stack install alex happy)
# from https://github.com/nodesource/distributions I found:
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

I ran this already (part of setting up a new box for me):

sudo apt-get install -y build-essential
sudo apt-get install -y zlib1g-dev libssl-dev libreadline-dev libyaml-dev \
                    libxml2-dev libxslt1-dev libcurl4-openssl-dev \
                    libffi-dev

After that the whole thing compiled, but I could not use it due to this error:

% ./try-stack-reflex ghcjsi                                                                   
Getting project config file from STACK_YAML environment
stack will use a locally installed GHCJS
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHCJS and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec
Getting project config file from STACK_YAML environment
Ignoring that the GHCJS boot package "aeson" has a different version, 0.9.0.1, than the resolver's wanted version, 0.8.0.2
Ignoring that the GHCJS boot package "attoparsec" has a different version, 0.13.0.1, than the resolver's wanted version, 0.12.1.6
Ignoring that the GHCJS boot package "scientific" has a different version, 0.3.3.8, than the resolver's wanted version, 0.3.4.2
Ignoring that the GHCJS boot package "case-insensitive" has a different version, 1.2.0.4, than the resolver's wanted version, 1.2.0.5
Ignoring that the GHCJS boot package "hashable" has a different version, 1.2.3.2, than the resolver's wanted version, 1.2.3.3
Ignoring that the GHCJS boot package "async" has a different version, 2.0.1.6, than the resolver's wanted version, 2.0.2
Ignoring that the GHCJS boot package "vector" has a different version, 0.11.0.0, than the resolver's wanted version, 0.10.12.3
Ignoring that the GHCJS boot package "text" has a different version, 1.2.1.1, than the resolver's wanted version, 1.2.1.3
Ignoring that the GHCJS boot package "dlist" has a different version, 0.7.1.1, than the resolver's wanted version, 0.7.1.2
Ignoring that the GHCJS boot package "pretty" has a different version, 1.1.3.2, than the resolver's wanted version, 1.1.2.0
Ignoring that the GHCJS boot package "containers" has a different version, 0.5.6.3, than the resolver's wanted version, 0.5.6.2
Ignoring that the GHCJS boot package "primitive" has a different version, 0.6, than the resolver's wanted version, 0.6.1.0
Ignoring that the GHCJS boot package "transformers" has a different version, 0.4.3.0, than the resolver's wanted version, 0.4.2.0
Getting project config file from STACK_YAML environment
Couldn't get a file descriptor referring to the console

And stack path shows me:

No compiler found, expected exact version ghcjs-0.2.0.20151001_ghc-7.10.2 (x86_64) (based on resolver setting in /tmp/try-stack-reflex/stack.yaml).
Try running "stack setup" to install the correct GHC into /home/cies/.stack/programs/x86_64-linux/

Any ideas on how to remedy this?

./try-stack-reflex builds native binary rather than JS binary

% type ghc
ghc is /home/jchee/.stack/programs/x86_64-linux/ghc-7.10.2/bin/ghc
[jchee@gratia:~/packages/try-stack-reflex on master]
% ghc --version      
The Glorious Glasgow Haskell Compilation System, version 7.10.2
[jchee@gratia:~/packages/try-stack-reflex on master]
% ./try-stack-reflex 
Getting project config file from STACK_YAML environment
GHC on PATH would be used
Getting project config file from STACK_YAML environment
While constructing the BuildPlan the following exceptions were encountered:

--  Failure when adding dependencies:    
      webkitgtk3: needed (>=0.14.0.0 && <0.15), but not present in build plan, latest is 0.14.1.1
    needed for package: ghcjs-dom-0.2.2.0

--  Failure when adding dependencies:    
      ghcjs-dom: needed (>=0.2.1 && <0.3), but couldn't resolve its dependencies
      webkitgtk3: needed (==0.14.*), but not present in build plan, latest is 0.14.1.1
      webkitgtk3-javascriptcore: needed (==0.13.*), but not present in build plan, latest is 0.13.1.1
    needed for package: reflex-dom-0.2

--  Failure when adding dependencies:    
      ghcjs-dom: needed (==0.2.*), but couldn't resolve its dependencies
      reflex-dom: needed (-any), but couldn't resolve its dependencies
    needed for package: reflex-todomvc-0.1

--  While attempting to add dependency,
    Could not find package webkitgtk3 in known packages

--  While attempting to add dependency,
    Could not find package webkitgtk3-javascriptcore in known packages

Recommended action: try adding the following to your extra-deps in /home/jchee/packages/try-stack-reflex/stack-ghcjs-improved-base.yaml
- webkitgtk3-0.14.1.1
- webkitgtk3-javascriptcore-0.13.1.1

You may also want to try the 'stack solver' command

Add the recommended packages and retry:

% git stash pop
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   stack-ghcjs-improved-base.yaml

no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (25419f6473d05b2fd2741f7a6ed8d39fe0b3b790)
[jchee@gratia:~/packages/try-stack-reflex on master]
% git diff
diff --git a/stack-ghcjs-improved-base.yaml b/stack-ghcjs-improved-base.yaml
index fa2c51e..5783ce8 100644
--- a/stack-ghcjs-improved-base.yaml
+++ b/stack-ghcjs-improved-base.yaml
@@ -27,3 +27,5 @@ extra-deps:
   - ref-tf-0.4
   - these-0.6.1.0
   - ghcjs-dom-0.2.2.0 # improved-base compatible with (2015-10-01 ghcjs)
+  - webkitgtk3-0.14.1.1
+  - webkitgtk3-javascriptcore-0.13.1.1
[jchee@gratia:~/packages/try-stack-reflex on master]
% ./try-stack-reflex
Getting project config file from STACK_YAML environment
GHC on PATH would be used
Getting project config file from STACK_YAML environment
ref-tf-0.4: configure
these-0.6.1.0: configure
ref-tf-0.4: build
webkitgtk3-0.14.1.1: configure
these-0.6.1.0: build
ref-tf-0.4: install
webkitgtk3-0.14.1.1: build
these-0.6.1.0: install
reflex-0.3: configure
reflex-0.3: build
reflex-0.3: install
webkitgtk3-0.14.1.1: install
webkitgtk3-javascriptcore-0.13.1.1: configure
ghcjs-dom-0.2.2.0: configure
webkitgtk3-javascriptcore-0.13.1.1: build
ghcjs-dom-0.2.2.0: build
webkitgtk3-javascriptcore-0.13.1.1: install
ghcjs-dom-0.2.2.0: install
reflex-dom-0.2: configure
reflex-dom-0.2: build
reflex-dom-0.2: install
reflex-todomvc-0.1: configure
Configuring reflex-todomvc-0.1...
reflex-todomvc-0.1: build
Building reflex-todomvc-0.1...
Preprocessing library reflex-todomvc-0.1...
[1 of 1] Compiling Reflex.TodoMVC   ( src/Reflex/TodoMVC.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Reflex/TodoMVC.o )
In-place registering reflex-todomvc-0.1...
Preprocessing executable 'reflex-todomvc' for reflex-todomvc-0.1...
[1 of 1] Compiling Main             ( src-bin/main.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/reflex-todomvc/reflex-todomvc-tmp/Main.o )
Linking .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/reflex-todomvc/reflex-todomvc ...
reflex-todomvc-0.1: install
Installing library in
/home/jchee/packages/try-stack-reflex/.stack-work/install/x86_64-linux/lts-3.10/7.10.2/lib/x86_64-linux-ghc-7.10.2/reflex-todomvc-0.1-3eNFqovyQ3w33ppa7pcxpV
Installing executable(s) in
/home/jchee/packages/try-stack-reflex/.stack-work/install/x86_64-linux/lts-3.10/7.10.2/bin
Registering reflex-todomvc-0.1...
Completed all 8 actions.
Couldn't get a file descriptor referring to the console
[jchee@gratia:~/packages/try-stack-reflex on master]1 ‽‽‽
% file /home/jchee/packages/try-stack-reflex/.stack-work/install/x86_64-linux/lts-3.10/7.10.2/bin/reflex-todomvc 
/home/jchee/packages/try-stack-reflex/.stack-work/install/x86_64-linux/lts-3.10/7.10.2/bin/reflex-todomvc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=6ef1cdd88bcb26224f2ebbceacde071d0ed9a3b0, stripped
[jchee@gratia:~/packages/try-stack-reflex on master]
% ls -al /home/jchee/packages/try-stack-reflex/.stack-work/install/x86_64-linux/lts-3.10/7.10.2/bin               
total 9124
drwxr-xr-x 2 jchee jchee    4096 Dec 15 16:01 .
drwxrwxr-x 8 jchee jchee    4096 Dec 15 16:01 ..
-rwxr-xr-x 1 jchee jchee 9332128 Dec 15 16:01 reflex-todomvc

ghcjs could not be determined

It seems the planets have aligned against me in my quest for using ghci/ghcjsi with reflex-dom.

Ever seen this before?

    Configuring ghcjs-dom-0.2.2.0...
    setup-Simple-Cabal-1.22.4.0-ghcjs-0.2.0.20151001_ghc-7.10.2: The program
    'ghcjs' version >=0.1 is required but the version of
    /Users/dmj/.stack/programs/x86_64-osx/ghcjs-0.2.0.20151001_ghc-7.10.2/bin/ghcjs
    could not be determined.

Ghc is required but not found.

Getting project config file from STACK_YAML environment
stack will use a locally installed GHCJS
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHCJS and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec
Getting project config file from STACK_YAML environment
Ignoring that the GHCJS boot package "scientific" has a different version, 0.3.3.8, than the resolver's wanted version, 0.3.4.4
Ignoring that the GHCJS boot package "case-insensitive" has a different version, 1.2.0.4, than the resolver's wanted version, 1.2.0.5
Ignoring that the GHCJS boot package "hashable" has a different version, 1.2.3.2, than the resolver's wanted version, 1.2.4.0
Ignoring that the GHCJS boot package "async" has a different version, 2.0.1.6, than the resolver's wanted version, 2.1.0
Ignoring that the GHCJS boot package "text" has a different version, 1.2.1.1, than the resolver's wanted version, 1.2.2.0
Ignoring that the GHCJS boot package "syb" has a different version, 0.5.1, than the resolver's wanted version, 0.6
Ignoring that the GHCJS boot package "stm" has a different version, 2.4.4, than the resolver's wanted version, 2.4.4.1
Ignoring that the GHCJS boot package "parallel" has a different version, 3.2.0.6, than the resolver's wanted version, 3.2.1.0
Ignoring that the GHCJS boot package "dlist" has a different version, 0.7.1.1, than the resolver's wanted version, 0.7.1.2
Ignoring that the GHCJS boot package "pretty" has a different version, 1.1.3.2, than the resolver's wanted version, 1.1.2.0
Ignoring that the GHCJS boot package "containers" has a different version, 0.5.6.3, than the resolver's wanted version, 0.5.6.2
Ignoring that the GHCJS boot package "transformers" has a different version, 0.4.3.0, than the resolver's wanted version, 0.4.2.0
happy-1.19.5: configure
happy-1.19.5: build
Progress: 1/6
-- While building package happy-1.19.5 using:
/tmp/stack4329/happy-1.19.5/.stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs build --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: /home/kyle/Programming/haskell/try-stack-reflex/.stack-work/logs/happy-1.19.5.log

[1 of 1] Compiling Main             ( /tmp/stack4329/happy-1.19.5/Setup.lhs, /tmp/stack4329/happy-1.19.5/.stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/setup/Main.js_o )

/tmp/stack4329/happy-1.19.5/Setup.lhs:20:1: Warning: Tab character

/tmp/stack4329/happy-1.19.5/Setup.lhs:21:1: Warning: Tab character

/tmp/stack4329/happy-1.19.5/Setup.lhs:22:1: Warning: Tab character

/tmp/stack4329/happy-1.19.5/Setup.lhs:68:1: Warning: Tab character

/tmp/stack4329/happy-1.19.5/Setup.lhs:74:1: Warning: Tab character

/tmp/stack4329/happy-1.19.5/Setup.lhs:81:19: Warning: Tab character

/tmp/stack4329/happy-1.19.5/Setup.lhs:82:23: Warning: Tab character

/tmp/stack4329/happy-1.19.5/Setup.lhs:83:26: Warning: Tab character

/tmp/stack4329/happy-1.19.5/Setup.lhs:84:26: Warning: Tab character

/tmp/stack4329/happy-1.19.5/Setup.lhs:85:30: Warning: Tab character

/tmp/stack4329/happy-1.19.5/Setup.lhs:86:33: Warning: Tab character

/tmp/stack4329/happy-1.19.5/Setup.lhs:87:32: Warning: Tab character

/tmp/stack4329/happy-1.19.5/Setup.lhs:88:36: Warning: Tab character

/tmp/stack4329/happy-1.19.5/Setup.lhs:89:39: Warning: Tab character

/tmp/stack4329/happy-1.19.5/Setup.lhs:94:14: Warning: Tab character

/tmp/stack4329/happy-1.19.5/Setup.lhs:99:13: Warning: Tab character

/tmp/stack4329/happy-1.19.5/Setup.lhs:100:17: Warning:
    Tab character

/tmp/stack4329/happy-1.19.5/Setup.lhs:101:23: Warning:
    Tab character
Linking /tmp/stack4329/happy-1.19.5/.stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/setup/setup.jsexe (Main)
Configuring happy-1.19.5...
Linking /tmp/stack4329/happy-1.19.5/.stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/setup/setup.jsexe (Main)
Building happy-1.19.5...
Preprocessing executable 'happy' for happy-1.19.5...
[ 1 of 18] Compiling NameSet          ( src/NameSet.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/NameSet.js_o )
[ 2 of 18] Compiling GenUtils         ( src/GenUtils.lhs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/GenUtils.js_o )
[ 3 of 18] Compiling Target           ( src/Target.lhs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/Target.js_o )
[ 4 of 18] Compiling AbsSyn           ( src/AbsSyn.lhs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/AbsSyn.js_o )
[ 5 of 18] Compiling ParamRules       ( src/ParamRules.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/ParamRules.js_o )

/tmp/stack4329/happy-1.19.5/src/ParamRules.hs:5:1: Warning:
    Module ‘Control.Monad.Error’ is deprecated:
      Use Control.Monad.Except instead

/tmp/stack4329/happy-1.19.5/src/ParamRules.hs:6:1: Warning:
    Module ‘Control.Monad.Instances’ is deprecated:
      This module now contains no instances and will be removed in the future

/tmp/stack4329/happy-1.19.5/src/ParamRules.hs:31:17: Warning:
    In the use of type constructor or class ‘ErrorT’
    (imported from Control.Monad.Error, but defined in transformers-0.4.3.0:Control.Monad.Trans.Error):
    Deprecated: "Use Control.Monad.Trans.Except instead"

/tmp/stack4329/happy-1.19.5/src/ParamRules.hs:71:10: Warning:
    In the use of type constructor or class ‘ErrorT’
    (imported from Control.Monad.Error, but defined in transformers-0.4.3.0:Control.Monad.Trans.Error):
    Deprecated: "Use Control.Monad.Trans.Except instead"

/tmp/stack4329/happy-1.19.5/src/ParamRules.hs:72:27: Warning:
    In the use of ‘runErrorT’
    (imported from Control.Monad.Error, but defined in transformers-0.4.3.0:Control.Monad.Trans.Error):
    Deprecated: "Use Control.Monad.Trans.Except instead"
[ 6 of 18] Compiling ParseMonad       ( src/ParseMonad.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/ParseMonad.js_o )
[ 7 of 18] Compiling AttrGrammar      ( src/AttrGrammar.lhs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/AttrGrammar.js_o )
[ 8 of 18] Compiling AttrGrammarParser ( .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/AttrGrammarParser.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/AttrGrammarParser.js_o )
[ 9 of 18] Compiling Grammar          ( src/Grammar.lhs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/Grammar.js_o )
[10 of 18] Compiling First            ( src/First.lhs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/First.js_o )
[11 of 18] Compiling LALR             ( src/LALR.lhs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/LALR.js_o )
[12 of 18] Compiling Lexer            ( src/Lexer.lhs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/Lexer.js_o )
[13 of 18] Compiling Parser           ( .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/Parser.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/Parser.js_o )
[14 of 18] Compiling Paths_happy      ( .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/autogen/Paths_happy.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/Paths_happy.js_o )
[15 of 18] Compiling ProduceCode      ( src/ProduceCode.lhs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/ProduceCode.js_o )
[16 of 18] Compiling ProduceGLRCode   ( src/ProduceGLRCode.lhs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/ProduceGLRCode.js_o )
[17 of 18] Compiling Info             ( src/Info.lhs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/Info.js_o )
[18 of 18] Compiling Main             ( src/Main.lhs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy-tmp/Main.js_o )
Linking .stack-work/dist/x86_64-linux/Cabal-1.22.4.0_ghcjs/build/happy/happy.jsexe (AbsSyn,AttrGrammar,AttrGrammarParser,First,GenUtils,Grammar,Info,LALR,Lexer,Main,NameSet,ParamRules,ParseMonad,Parser,Paths_happy,ProduceCode,ProduceGLRCode,Target)
setup: The program 'ghc' is required but it could not be found

Do I need a ghc on my path? If so how to I place the stack ghc on my path.

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.