Install Haskell version 8.2.2: https://www.haskell.org/platform/prior.html
Elm will NOT build in 8.4.2.
Do once, after installing Haskell:
cabal update
Download the compiler source:
git clone git@github.com:elm/compiler.git
Build:
cd .../compiler
cabal sandbox init
cabal install
After a while, the executable will be in .cabal-sandbox/bin/elm
To remove all the build artifacts for another clean build:
cabal clean
rm -r .cabal-sandbox
Unfortunately, building with profiling as documented below doesn't work, since the distributed Haskell libraries don't have their profiling versions. Some magic with stack
, to completely rebuild the Haskell libraries, will probably fix it, but I haven't figured that out yet.
To build with profiling, which enables stack backtraces on errors, add the --enable-profiling
flag:
cabal install --enable-profiling
To compile Elm code with full stack backtraces on errors:
.../compiler/.cabal-sandbox/bin/elm +RTS -xc make ...