summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorobadz <dav-github@odav.org>2016-04-09 03:25:04 +0100
committerobadz <dav-github@odav.org>2016-04-11 15:24:56 +0100
commit7f2163fc97d422bf19f71f09f4c813e49b1fcc8e (patch)
treee5309dc00b6a8cefe80d1fd935550d5e2fdb7a6c /doc
parente8b3532d26c15f308c4b597128da8b3b9554e932 (diff)
downloadnixpkgs-7f2163fc97d422bf19f71f09f4c813e49b1fcc8e.tar
nixpkgs-7f2163fc97d422bf19f71f09f4c813e49b1fcc8e.tar.gz
nixpkgs-7f2163fc97d422bf19f71f09f4c813e49b1fcc8e.tar.bz2
nixpkgs-7f2163fc97d422bf19f71f09f4c813e49b1fcc8e.tar.lz
nixpkgs-7f2163fc97d422bf19f71f09f4c813e49b1fcc8e.tar.xz
nixpkgs-7f2163fc97d422bf19f71f09f4c813e49b1fcc8e.tar.zst
nixpkgs-7f2163fc97d422bf19f71f09f4c813e49b1fcc8e.zip
haskellPackages.haste-compiler: fix so that it now builds and runs
Required adding:
haskellPackages.haste-Cabal, and
haskellPackages.haste-cabal-install
Diffstat (limited to 'doc')
-rw-r--r--doc/haskell-users-guide.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/haskell-users-guide.md b/doc/haskell-users-guide.md
index ce61295e567..b981466bf2e 100644
--- a/doc/haskell-users-guide.md
+++ b/doc/haskell-users-guide.md
@@ -647,6 +647,30 @@ command, i.e. by running:
     rm /nix/var/nix/manifests/*
     rm /nix/var/nix/channel-cache/*
 
+### How to use the Haste Haskell-to-Javascript transpiler
+
+Open a shell with `haste-compiler` and `haste-cabal-install` (you don't actually need
+`node`, but it can be useful to test stuff):
+
+    $ nix-shell -p "haskellPackages.ghcWithPackages (self: with self; [haste-cabal-install haste-compiler])" -p nodejs
+
+You may not need the following step but if `haste-boot` fails to compile all the
+packages it needs, this might do the trick
+
+    $ haste-cabal update
+
+`haste-boot` builds a set of core libraries so that they can be used from Javascript
+transpiled programs:
+
+    $ haste-boot
+
+Transpile and run a "Hello world" program:
+
+    $ echo 'module Main where main = putStrLn "Hello world"' > hello-world.hs
+    $ hastec --onexec hello-world.hs
+    $ node hello-world.js
+    Hello world
+
 ### Builds on Darwin fail with `math.h` not found
 
 Users of GHC on Darwin have occasionally reported that builds fail, because the